1
votes

I have a usecase wherein I save an entity for the first time and a second after saving it I fetch it, update it a bit and save it in batch along with two other entites (different 'kinds'). In a few cases (10 out of 50K), the update to datastore is ignored. I mean, it's there in the objectify cache but the change didn't happen in datastore. How I am able to justify the above, is because after the save, I fetch it again after a second and I'm able to see it.

PS: I also use .now() while saving. This shouldn't happen when now() is used right?

1
@stickfigure I've been facing a similar issue and I have seen you answering a lot on queries related to objectify. Could you please help us out here? - XenoChrist

1 Answers

0
votes

Sounds like you are seeing eventual consistency in the datastore. There is quite a bit of Google documentation available, but this looks to be the most comprehensive:

https://cloud.google.com/datastore/docs/articles/balancing-strong-and-eventual-consistency-with-google-cloud-datastore/

There are a lot of ways to deal with eventual consistency, either by avoiding it (using get-by-key operations), changing the structure of your data (using @Parent relationships), or masking it with UI behavior (say, add the new thing to the list in UI code instead of just refreshing the whole list).