Re: [google-appengine] Entity groups - does work on a child lock the parent, and vice versa?
From the Python documentation: When you use the App Engine datastore, every attempt to create, update, or delete an entity happens in a transaction. This means, I think, that GAE will perform/create a transaction for you, in the API, if the put() code is not already inside a transaction. So you don't need to code a transaction to create a child object, GAE will do that for you. # no need for a transaction here. Grok(parent=myFoo).put() # python syntax Code the transaction yourself if you need to modify multiple objects in the entity group. 2011/1/13 Stephen Johnson onepagewo...@gmail.com: From the documentation: While an app is applying changes to entities in an entity group, all other attempts to update any entity in the group fail at commit time. Because of this design, using entity groups limits the number of concurrent writes you can do on any entity in that group. When a transaction starts, App Engine uses optimistic concurrency control by checking the last update time for the entity group. Upon commiting a transaction for an entity group, App Engine again checks the last update time for the entity group. If it has changed since our initial check, we throw an exception. For an explanation of entity groups, see Entity Groups. On Thu, Jan 13, 2011 at 10:48 AM, Mark mar...@gmail.com wrote: Hi, Let's say we have an entity group hierarchy like this: Foo | --- Grok Foo is the entity parent. Any time I add a Grok instance to the datastore, does the parent Foo instance have to be locked? Example: Transaction tx = pm.currentTransaction(); try { tx.begin(); Grok grok = new Grok(); pm.makePersistent(grok); tx.commit(); // will a parent Foo get locked now? } finally { if (tx.isActive()) { tx.rollback(); } I guess the same question then - if I'm performing a transaction on the parent Foo, will all its Grok instances be locked? Thanks -- 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.
[google-appengine] Entity groups - does work on a child lock the parent, and vice versa?
Hi, Let's say we have an entity group hierarchy like this: Foo | --- Grok Foo is the entity parent. Any time I add a Grok instance to the datastore, does the parent Foo instance have to be locked? Example: Transaction tx = pm.currentTransaction(); try { tx.begin(); Grok grok = new Grok(); pm.makePersistent(grok); tx.commit(); // will a parent Foo get locked now? } finally { if (tx.isActive()) { tx.rollback(); } I guess the same question then - if I'm performing a transaction on the parent Foo, will all its Grok instances be locked? Thanks -- 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.
Re: [google-appengine] Entity groups - does work on a child lock the parent, and vice versa?
From the documentation: While an app is applying changes to entities in an entity group, all other attempts to update any entity in the group fail at commit time. Because of this design, using entity groups limits the number of concurrent writes you can do on any entity in that group. When a transaction starts, App Engine uses optimistic concurrency controlhttp://en.wikipedia.org/wiki/Optimistic_concurrency_controlby checking the last update time for the entity group. Upon commiting a transaction for an entity group, App Engine again checks the last update time for the entity group. If it has changed since our initial check, we throw an exception. For an explanation of entity groups, see Entity Groupshttp://code.google.com/appengine/docs/java/datastore/transactions.html#Entity_Groups . On Thu, Jan 13, 2011 at 10:48 AM, Mark mar...@gmail.com wrote: Hi, Let's say we have an entity group hierarchy like this: Foo | --- Grok Foo is the entity parent. Any time I add a Grok instance to the datastore, does the parent Foo instance have to be locked? Example: Transaction tx = pm.currentTransaction(); try { tx.begin(); Grok grok = new Grok(); pm.makePersistent(grok); tx.commit(); // will a parent Foo get locked now? } finally { if (tx.isActive()) { tx.rollback(); } I guess the same question then - if I'm performing a transaction on the parent Foo, will all its Grok instances be locked? Thanks -- 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.comgoogle-appengine%2bunsubscr...@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.