Hi Andy, strange that nobody replied to this question up to now. I was wondering the same thing, until I read in the docs:
(source:
https://developers.google.com/appengine/docs/java/datastore/transactions)
But, I still wonder how this is achieved. I thought that optimistic concurrency works like this:
- when we enter a transaction a timestamp is associated to the transaction.
- when we commit a transaction, the timestamp is compared with the modification timestamps of all "touched" entities in our transaction
- if there are entities which have a newer timestamp than the one of the transaction, the transaction fails
It seems that the Google datastore somehow achieves to freeze the datastore, so there is no conflict when another transaction modifies your data while you read it. However, if both transactions modify an entity, this is a conflict and the second transaction won't commit. My question: how is it technically achieved to look at a "freezed" version of the datastore from the point of view of a transaction?