

How Streak Tracks Down App Engine Datastore Bugs - alooPotato
http://developer.streak.com/2013/09/how-streak-tracks-down-datastore-bugs.html

======
ptgtp
"A typical scalable database engine like App Engine's Datastore will only look
at each entity in isolation. Since the entities are technically fine in
isolation, there's no guarantee of consistency from the engine level."

This is not true. A feature in app engine called entity groups were added to
work around exactly this type of problem. The Dog entities should have their
entity group (parent) set to The DogWalker. This will ensure full read/write
consistency among that group of entities.

Combine this with transactions, and cross-entity-group-transactions, and you
can ensure that you don't have dangling or incorrect pointers like what you
describe.

~~~
alooPotato
While its true that App Engine has entity groups and transactions on those
entity groups, you are still responsible for ensuring consistency in your
application code.

 _You_ have to remember set the pointers between the two entities correctly
and to do the write in a transaction. Granted this should be easy but mistakes
can be made.

Compare this to a tradition relational DB where this consistency is enforced
at the database engine level (if you've setup your schema in that way) and it
won't let you write inconsistent data.

~~~
ptgtp
Whether consistency is ensured at the application level or the database level,
mistakes can be made. Someone can forget to set things up in a schema
correctly in exactly the same way they can forget to implement things
correctly at the application level.

Also, even with relational databases, there are many times when you need to
use transactions to prevent certain types of inconsistencies, they don't
protect against everything.

