Robin Green
Robin Green

Reputation: 33063

Is getting a specific App Engine entity by key, when the key has a parent key, an ancestor query?

I need up-to-date consistency, not eventual consistency, so it seems like I should use an ancestor query. However, can App Engine not tell that when in Java I call

datastoreService.get(myKey)

when myKey has a parent key, that's effectively an ancestor query? Isn't the parent key of myKey an implicit ancestor restriction?

Upvotes: 0

Views: 81

Answers (2)

Nimit Pattanasri
Nimit Pattanasri

Reputation: 1602

Actually, App Engine datastore can be thought of as a key-value table. My theory is that retrieving values directly from the key-value table is "not" subject to eventual consistency. In contrast, when you issue a query against App Engine, the query does not go to the key-value table directly but is routed to the "index" table (in order to find a key!). And you know that it takes sometime to build/update the index; hence, eventual consistency applies here.

Upvotes: 0

Wooble
Wooble

Reputation: 89897

The consistency model is only relevant for queries. A get is not a query, it's a simple read. They are always strongly consistent.

Upvotes: 3

Related Questions