To further clarify. All writes are transactional. Details on how the
transactions work can be found in ryan's presentation from Google I/O:
http://snarfed.org/space/datastore_talk.html The section on
transactions specifically begins at slide 49. You can also watch the
video here: 
http://sites.google.com/site/io/under-the-covers-of-the-google-app-engine-datastore

Cheers,

Jeff

On Sep 22, 10:36 am, Jeff S <[EMAIL PROTECTED]> wrote:
> Hi David,
>
> Even if a put request to the datastore is not run in a transaction,
> the operation is automatically retried. Contention is not unique to
> transactions. The benefit of using transactions, is that if one write
> in the transaction times out (due to too much contention or some other
> issue) the other parts of the transaction will not be applied. For
> more details 
> see:http://code.google.com/appengine/docs/datastore/transactions.html#Usi...
>
> Happy coding,
>
> Jeff
>
> On Sep 18, 6:25 pm, DXD <[EMAIL PROTECTED]> wrote:
>
> > I appreciate any clarifications on my situation as follows. I have an
> > entity group whose the root entity is called "root". When a particular
> > URL is requested, a new entity is added to this group as a direct
> > child of root. The code looks similar to this:
>
> > def insert():
> >   root = Root.get_by_key_name('key_name')
> >   child = Child(parent=root)
> >   child.put()
>
> > Note that the insert() function is not run in a transaction (not
> > called by db.run_in_transaction()).
>
> > I spawned many concurrent requests to this URL. The log shows that
> > there are many failed requests with either "TransactionFailedError:
> > too much contention on these datastore entities. please try again" or
> > "DeadlineExceededError". Since I'm still a bit unclear about the
> > internal working of the datastore, these are my explanations for what
> > happened. Pls correct me where I'm wrong:
>
> > 1. when one child entity is being inserted, it locks the entire group.
> > All other concurrent requests are blocked, and their child.put()
> > statement exclusively is retried a number of times. Say the limit
> > number of retry is r.
>
> > 2. If child.put() is retried r times but still doesn't go through, it
> > gives up and yields the "too much contention" error.
>
> > 3. If child.put() does not yet reach r times of retry, but its session
> > already reaches the time limit t, then it fails yielding the
> > "DeadlineExceededError".
>
> > If my explanations are correct, isn't it true that the insert()
> > function is exactly equivalent to this version?:
>
> > def insert():
> >   root = Root.get_by_key_name('key_name')
> >   child = Child(parent=root)
> >   def txn()
> >     child.put()
> >   db.run_in_transaction(txn)
>
> > Or more generally, is it true that all API operations that write to
> > the datastore have exactly the same effect with transaction
> > (automatically retried if failed, and so on)?
>
> > Thanks for clarifications,
> > David.
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to