开发者

GAE Datastore concurrency question

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:

   theSam开发者_如何学CeEntity.setProperty ("foo", "abc");
   DatastoreService.put (theSameEntity);

Process B:

   theSameEntity.setProperty ("bar", 123);
   DatastoreService.put (theSameEntity);


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜