views:

54

answers:

2

Very simply, I wish to know if (in google app engine):

  1. When I make a POST or PUT HTTP request.
  2. And the POST or PUT creates a change to the google app engine database
  3. After the POST or PUT request returns
  4. Is there a guarantee that the index has been updated to reflect the changes made?

There is a explanation here about what happens when two request are made simultaneously, but I do not see this question specifically answered. Put simply, I wish to know if when I get a response from a POST or PUT, if there is a guarantee that all future request to the datastore will have indexes reflecting the changes that the POST or PUT made. Put in the context of the link provided above, is there a guarantee that the view of the database will be in milestone B when a request returns?

Thank you.

+1  A: 

The index is guaranteed to be updated once the transaction commits (that is, when commit returns, which implies reaching milestone B); if your request completed successfully, all of its transactions either committed or rolled back (in which case you caught the exception and handled it somehow or a 500 would result).

However I'm not sure what happens if your appserver crashes between milestone A and B - clearly you wouldn't get a successful response at the client, but I'm not aware of any assertion that this really will be recovered from properly.

bdonlan
+4  A: 

Even better than that - indexes are guaranteed to be updated and visible by all readers by the time the put() completes. Writes to the main datastore and the indexes are accomplished in parallel, and the put() request doesn't return until they're all accomplished.

Nick Johnson