My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 3643: Ancestor Queries in Transactions are not supported over Remote API
16 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Sep 2012


Sign in to add a comment
 
Reported by mbwes...@gmail.com, Aug 27, 2010

When I run this with remote api shell on local python dev server I get None:


> SomeKind.gql('WHERE something=:1 and ANCESTOR IS :2', something, something.parent_key()).get()
<models.SomeKind object at 0x1e6f210>
> def txn():
...  print SomeKind.gql('WHERE something=:1 and ANCESTOR IS :2', something, something.parent_key()).get()
...
> db.run_in_transaction(txn)
None



When I run this with remote api against appspot I get:

INFO:root:Exception sending Rollback:
Traceback (most recent call last):
  File "/workspace/project/lib/internal/google_appengine/google/appengine/api/datastore.py", line 2230, in RunInTransactionCustomRetries
    tx.handle, api_base_pb.VoidProto())
  File "/workspace/project/lib/internal/google_appengine/google/appengine/api/datastore.py", line 186, in _MakeSyncCall
    rpc.check_success()
  File "/workspace/project/lib/internal/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 474, in check_success
    self.__rpc.CheckSuccess()
  File "/workspace/project/lib/internal/google_appengine/google/appengine/api/apiproxy_rpc.py", line 149, in _WaitImpl
    self.request, self.response)
  File "/workspace/project/lib/internal/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py", line 223, in MakeSyncCall
    handler(request, response)
  File "/workspace/project/lib/internal/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py", line 414, in _Dynamic_Rollback
    assert (txdata[txid].thread_id ==
TypeError: 'TransactionData' object is unindexable

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/workspace/project/lib/appenginepatch/appenginepatcher/transactions.py", line 23, in handle_signals
    result = run_in_transaction(*args, **kwargs)
  File "/workspace/project/lib/internal/google_appengine/google/appengine/api/datastore.py", line 2132, in RunInTransaction
    DEFAULT_TRANSACTION_RETRIES, function, *args, **kwargs)
  File "/workspace/project/lib/internal/google_appengine/google/appengine/api/datastore.py", line 2223, in RunInTransactionCustomRetries
    result = function(*args, **kwargs)
  File "<console>", line 2, in txn
  File "/workspace/project/lib/internal/google_appengine/google/appengine/ext/db/__init__.py", line 1622, in get
    results = self.fetch(1, rpc=rpc)
  File "/workspace/project/lib/internal/google_appengine/google/appengine/ext/db/__init__.py", line 1675, in fetch
    raw = raw_query.Get(limit, offset, rpc=rpc)
  File "/workspace/project/lib/internal/google_appengine/google/appengine/api/datastore.py", line 1240, in Get
    limit=limit, offset=offset, prefetch_count=limit, **kwargs)._Get(limit)
  File "/workspace/project/lib/internal/google_appengine/google/appengine/api/datastore.py", line 1170, in _Run
    raise _ToDatastoreError(err)
BadRequestError: invalid handle: 1


and each time I run this the "invalid handle: " number increments by one.
Sep 3, 2010
#1 csch...@gmail.com
(No comment was entered for this change.)
Status: Acknowledged
Labels: log-2965673
Jan 12, 2011
Project Member #2 peter...@google.com
(No comment was entered for this change.)
Labels: Component-RemoteApi
Jan 31, 2011
#3 i...@google.com
(No comment was entered for this change.)
Labels: squash-2
Jul 13, 2011
#5 pa...@acm.org
This issue seems to have gotten worse with the 1.5.2 prerelease, anybody else experiencing the same?
Jul 13, 2011
#6 arful...@google.com
This error is actually hiding an error in your transaction (like a timeout/concurrency or bad request error).  
Status: Started
Jul 13, 2011
#7 arful...@google.com
BTW if you just delete the '[txid]' from 'assert (txdata[txid].thread_id ==' at File "/workspace/project/lib/internal/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py", line 414, in _Dynamic_Rollback it would reveal what the true exception is.
Aug 8, 2011
#8 arful...@google.com
The real problem is that Remote API simply doesn't support ancestor queries in a transaction. This is because remote api uses 'value locking' to detect concurrency and tracking the values of a query is significantly harder then tracking the value of get operations (though it is still very possible). For now we will add a better exception then the one currently thrown (the 2nd exception listed).
Apr 18, 2012
Project Member #9 tmat...@google.com
bulk edit
Labels: squash-1
Jul 25, 2012
#10 dhermes@google.com
(No comment was entered for this change.)
Labels: log-6881167
Jul 25, 2012
#11 danielho...@google.com
(No comment was entered for this change.)
Labels: -log-2965673
Sep 23, 2012
Project Member #12 tmat...@google.com
Fixed in 1.7.2.
Status: Fixed
Sign in to add a comment

Powered by Google Project Hosting