0

I am using djangoappengine and I think have run into some problems with the way it handles eventual consistency on the high application datastore.

First, entity groups are not even implemented in djangoappengine.

Second, I think that when you do a djangoappengine get, the underlying app engine system is doing an app engine query, which are only eventually consistent. Therefore, you cannot even assume consistency using keys.

Assuming those two statements are true (and I think they are), how does one build an app of any complexity using djangoappengine on the high replication datastore? Every time you save a value and then try to get the same value, there is no guarantee that it will be the same.

speedplane
  • 15,673
  • 16
  • 86
  • 138

3 Answers3

1

Take a look in djangoappengine/db/compiler.py:get_matching_pk()

If you do a djangomodel.get() by the pk, it'll translate to a Google App Engine Get(). Otherwise it'll translate to a query. There's room for improvement here. Submit a fix?

dragonx
  • 14,963
  • 27
  • 44
  • Okay thanks. So my second statement is in fact false... good to know. And if that is the case, you can create your own locks. You need to do a test-and-set within a transaction and the object lookup must only use its pk. Not perfect by any means, but it can stop certain types of races. – speedplane Feb 26 '12 at 04:33
  • There's also a pull request on github for parent key support. Also, it looks like it should be possible to modify compiler.py so that non-pk django get() calls still translate to appengine Get() calls. – dragonx Feb 27 '12 at 18:05
0

Don't really know about djangoappengine but an appengine query if it includes only key is considered a key only query and you will always get consistent results.

Nischal
  • 958
  • 2
  • 10
  • 14
  • Thanks but an appengine query != djangoappengine query. Also, I think you are confusing what a key-only queries is. – speedplane Feb 17 '12 at 15:25
0

No matter what the system you put on top of the AppEngine models, it's still true that when you save it to the datastore you get a key. When you look up an entity via its key in the HR datastore, you are guaranteed to get the most recent results.

Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895