Reputation: 41447
If two processes modify the same entity concurrently, but only modify different properties, can they potentially overwrite the changes made by the other process when calling DatastoreService.put
?
Process A:
theSameEntity.setProperty ("foo", "abc"); DatastoreService.put (theSameEntity);
Process B:
theSameEntity.setProperty ("bar", 123); DatastoreService.put (theSameEntity);
Upvotes: 1
Views: 246
Reputation: 66
Yes, I have observed this (though in my case the concurrent requests modified the same property).
I don't think transactions will help because they don't lock the datastore they guarantee, that the operations in the transaction will see the same data. I Would like to know if anyone has found a solution to this.
Upvotes: 1
Reputation: 98856
Yes, it's possible they'll overwrite each other's changes, since the entire entity is sent to the datastore (serialized using protocol buffers) with each write (not just a diff).
You'll need to use transactions if you want to avoid this.
Upvotes: 3