HN user

ptgtp

2 karma
Posts0
Comments3
View on HN
No posts found.

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.

My reply was mainly aimed at the example posted here, really how often will a Dog Walker's set of Dogs change? Keep in mind that transactions can have retries too, so it's not enough for 2 requests to collide, it needs to be entity groups with > 1 write per second for that to be an issue.

But beyond that, there are other app engine tools like task queues, which can make dealing with contention pretty easy.

"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.