Well, I generally put revision numbers on my entities.  In my
transctions, before the update, I check that the revision number
currently on the entity matches what I expect.  If it doesn't then I
know the update is out-of-date.

There are other solutions too, depending on the app and data model.


Robert



On Tue, Jul 26, 2011 at 15:03, Joshua Smith <joshuaesm...@charter.net> wrote:
> On this topic, nobody ever answered this question:
>
> http://code.google.com/appengine/docs/python/datastore/transactions.html
>
> First it says, "Make sure your transactions are idempotent" and then it
> gives an example which isn't.
>
> I'm not sure it's possible to do the task in that example correctly if you
> cannot tell whether a transaction succeeded or failed when it throws an
> exception. I just tried sketching out a solution that stored a transaction
> ID in the model, but that won't work because there could be multiple
> writers. The whole thing seems rather intractable, and the idea that you
> cannot tell whether a transaction succeeded or failed violates the principle
> of least surprise for anyone who's ever used a database!
>
> Can some googlers weigh in, and explain how, for example, the example in the
> documentation could be implemented correctly?
>
>
> So, can you?
> I think that the idea of making transactions idempotent is nonsense.  I
> don't think it is going to be possible in many cases.
> Either you support transactions, or you don't.  By my reading, GAE doesn't.
> -Joshua
> On Jul 26, 2011, at 3:40 PM, Jose Montes de Oca wrote:
>
> Hi Pol,
> What this meas is that even if a transaction throws an exception this does
> not means the transaction failed, thats why you need to make your datastore
> transaction idempotent. So if you retry a transaction because it throws an
> exception, your transaction needs to "check" if the last
> transaction committed successfully or not.
> Best,
> Jose Montes de Oca
> --
> 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/-/bm54SrfYFdAJ.
> To post to this group, send email to google-appengine@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to google-appengine@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to