I'm trying to figure out and diagnose an odd problem, and my best guess so 
far is that a datastore transaction successfully stored data* and* also 
returned an error message.

(I happen to be using Python, but this might be a general datastore issue)

The code goes about like this:

txn(key):
 x = db.get(key)
 x.foo += 1
 x.put()
 logging.info('go!')
 # transactionally enqueue something to a task-queue
 return

foo(key):
 while True:
  try:
   db.run_in_transaction(txn, key)
  except Exception, e:
   logging.exception('ouch')
   time.sleep(10.0) # wait 10 seconds
   continue # fast inline retry
  else:
   return


What I'm seeing is that there was one logged exception:
"The datastore operation timed out, or the data was temporarily 
unavailable."
The 'go!' line is logged twice, each time through the transaction, x.foo is 
incremented twice and the task-queue task runs once.


What really bugs me is that x.foo added 2 where I wanted to add 1.
What really bugs me after that is that it seems that the datastore part of 
the transaction seems to have run twice while the task-queue part of the 
transaction seems to have run once.

Another thing that bugs me, but I'm kinda coming to terms with it, is that a 
transaction can complete successfully and the API still returns an error. I 
suppose this was always possible if all the actions happened on the 
datastore server machine but then the connection to the appengine instance 
died and never got notified that the transaction happened. The data may be 
safe and consistent, but it makes my logical flow of programming around the 
operation messier.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/Ay0pmrE4720J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to