Question

I have implemented two server-side HTTP endpoints which 1) stores some data and 2) processes it. Method 1) calls method 2) through App Engine Tasks since they are time consuming tasks that I do not want the client to wait for. The process is illustrated in the sequence diagram below.

Now from time to time I experience that the processing task (named processSomething in the sequence diagram below) can't find the data when attempting to process - illustrated with the yellow throw WtfException() below. Can this be explained with the Eventual Consistency model described here?

The document says Strong consistency for reads but eventual consistency for writes. I'm not sure what exactly that means related to this case. Any clarification is appreciated.

enter image description here

edit: I realize I'm asking a boolean question here, but I guess I'm looking for an answer backed up with some documentation on what Eventual Consistency is in general and specifically on Google Datastore

edit 2: By request here are details on the actual read/write operations:

The write operation:

entityManager.persist(hand); 
entityManager.close() 

I'm using JPA for data persistance. Object 'hand' is recieved from client and not previously stored in the db so a new key Id will be assigned.

The read operation:

SELECT p FROM Hand p WHERE p.GameId = :gid AND p.RoundNo = :rno

Neither GameId nor RoundNo is the primary key. GameId is a "foreign key" although the Datastore is oblivious of that by design.

Was it helpful?

Solution

It would help if you showed actual code, showing how you save the entity and how you retrieve it, but assuming that id is an actual datastore ID, part of a Key, and that your load is a get using the id and not a query on some other property then eventual-consistency is not your issue.

(The documentation on this is further down the page you linked.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top