Consistently getting inconsistent reads in GAE Java DataStore

Showing 1-6 of 6 messages
Consistently getting inconsistent reads in GAE Java DataStore Rémi Bastide 1/28/12 9:40 AM
Several people have detected a strange behaviour in Google App Engine JDO, where your app unpredictably returns stale data.

I've written a small servlet to demonstrate this.

The code is included in this note, and the app uses the plain vanilla jdoconfig.xml also included here.

You can see it live deployed in appengine here 

When using this app, you will notice that occasionally the records that have just been added or deleted do not show up until a couple of refreshes.

Things that have been tried but do not appear to work : 
  • Wrapping transactions around adds and deletes
  • Using cache control headers in response
  • setting <property name="datanucleus.appengine.datastoreReadConsistency" value="STRONG" /> in jdoconfig.xml

I suspect a threading issue that can be solved by configuration options... 

I must be doing something terribly wrong, but I do not see what...
Any help appreciated

Re: [google-appengine] Consistently getting inconsistent reads in GAE Java DataStore Joshua Smith 1/28/12 12:32 PM
If you are using HRD, this is a well-documented limitation.

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/3nebSrKk9G4J.
To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
<StaledataServlet.java><jdoconfig.xml>

Re: Consistently getting inconsistent reads in GAE Java DataStore Simon Knott 1/28/12 3:37 PM
As Joshua mentions, if you are on HRD you are simply experiencing eventual consistency.  Unless you do gets by keys, which will always give you up-to-date data, you will potentially experience stale data due to the time it takes to replicate the entities and indexes across the GAE replicated datastore.

Cheers,
Simon
Re: Consistently getting inconsistent reads in GAE Java DataStore André Pankraz 1/28/12 11:20 PM
Even with "gets by key"...may be I'm wrong, but you can put/update an entity, commit/end the transaction and a following "get entity by key" may return stale data - right?
Entity replication takes it's time too - index updates are delayed even further (link explains it, 2 steps) and you encounter the effect more often.

Or not? I find the documentation to this topic annoying and confusing - and for me it's the major pain point with the data store. Complicates write logic etc.

Re: Consistently getting inconsistent reads in GAE Java DataStore Simon Knott 1/29/12 1:07 AM
Gets by key always return consistent data, unless you specifically force it to be eventually consistent.  Similarly, ancestor queries on the HR datastore always give you the correct data.  Both are wrapped in transactions in the background, I believe.

The overview on http://code.google.com/appengine/docs/python/datastore/hr/ describes which elements have strong and weak consistency on the different datastores.
Re: Consistently getting inconsistent reads in GAE Java DataStore Rémi Bastide 1/29/12 1:29 AM
Thanks to you all for the input. However, I'm quite surprised :
  • I disabled "Local HRD support" in "Appengine properties" (I'm using Eclipse plugin) 
    • The app now appears to work normally (i.e showing no stale data) when run locally
  • My appengine app bastide07 indicates " Master/Slave Replication"
I