Yes. The only way to correctly do this is with transactions and sharded counters.
The better question, however, is this: what are you doing? Perhaps there is an alternative solution. Ikai Lan Developer Programs Engineer, Google App Engine Blog: http://googleappengine.blogspot.com Twitter: http://twitter.com/app_engine Reddit: http://www.reddit.com/r/appengine On Thu, Mar 3, 2011 at 10:57 AM, justin <[email protected]> wrote: > I need to write code so that a user has a counter. This counter can be > read, increase, and decrease. This counter is mission critical so I > will use the high replication datastore. > > So lets say I create a counter entity which has a user entity as the > ancestor. I increase the counter value and store the value. Almost > simultaneously I get another request to read the counter. I get the > entity from the datastore , using the correct ancestor chain, and I > read the value. Is it possible that these two values will be > different? If so, is there anyway way to prevent this from happening? > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
