That was a miscommunication; Nick was just saying that a Put is an upsert
operation. Concurrency is handled at a "whole transaction" level. When you
'touch' EGs, you enlist them in your transaction; when you commit the
transaction, if any of those EGs have been modified by someone else, your
transaction fails.

If you make all transactions idempotent and retry them, your app will be
fine and you don't have to worry about edge cases.

HOWEVER, you have to take idempotence rather seriously. The "edge cases" of
the datastore produce errors/exceptions. Errors can happen even if the
underlying transaction committed successfully. Your Counter example is not
an idempotent transaction - if you retry it, it can produce a miscount.

That may not matter; usually counters are fairly flexible, and the
likelihood of success-but-error is low. If you need to make an *exact*
count, you have to work a little harder at constructing the transaction.

If you have further questions and can ask them at a conceptual level, we
can help. However, you will not likely get implementation details out of
Google. Forget timestamps, they don't really matter.

Jeff





On Sun, May 17, 2015 at 3:56 PM, Francis Stephens <f...@belua.com> wrote:

> Nick,
>
> The Puts in the code snippet really mustn't 'always put the entity'. It is
> crucial in this scenario that one of the Puts fails. If all Puts always
> succeed (barring non-concurrent failures) then the transactions definitely
> don't work.
>
> With respect I can't not "*worry about how they work, you just need to
> trust they do". *My expectation is that the App Engine datastore really
> is like every other persistence software I've ever used. If you look
> closely at the isolation guarantees given by popular relational databases
> you will see a raft of complex and surprising edge cases.
>
> A good review of these complexities to be found is
>
>
> http://www.xaprb.com/blog/2014/12/08/eventual-consistency-simpler-than-mvcc/
>
> Francis
>
> On 17 May 2015 at 22:42, Nick <naoku...@gmail.com> wrote:
>
>> Apologies, forgot one important item:
>>
>> 6. The datastore uses a restful interface. A put always puts the entity,
>> regardless of whether it already exists or not. If you use a deterministic
>> key the behavior you seek will just happen. It will create an entity if
>> none exists, or update the existing one if it does.
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Google App Engine" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/google-appengine/NagJ97YExB0/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> google-appengine+unsubscr...@googlegroups.com.
>> To post to this group, send email to google-appengine@googlegroups.com.
>> Visit this group at http://groups.google.com/group/google-appengine.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/google-appengine/bff8ff78-e87d-4c47-ade9-9f83249c5777%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Francis Stephens
> Software Developer @ Belua
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-appengine+unsubscr...@googlegroups.com.
> To post to this group, send email to google-appengine@googlegroups.com.
> Visit this group at http://groups.google.com/group/google-appengine.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-appengine/CAG1f2XCreTw_FN6Wx%3Dm_d%3DQdFVSs3wkrh8w4BrkqsmOaM7s8kg%40mail.gmail.com
> <https://groups.google.com/d/msgid/google-appengine/CAG1f2XCreTw_FN6Wx%3Dm_d%3DQdFVSs3wkrh8w4BrkqsmOaM7s8kg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/CADK-0ujCg8oU-kvs7Zc8mo%2BfpXmFE-2ykfkL9S%3DSXSVEthPuwA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to