Lets say I am working with root entities, and I want to
transactionally insert entities based on key_name.
def txn(name):
post = Post.get_by_key_name(name)
if post is None:
post = Post(key_name=name)
post.put()
return (post, True)
else:
return (post, False)
Lets say there are no Post entities inserted yet. What happens from a
locking/contention perspective when db.run_in_transaction(txn,
'foobar') is executed concurrently on 100 nodes?
Transactions on root entities are supposed to be independent, which
would means you would get many Posts with key_name='foobar'. However,
if the transactions are not independent, you will get write
contention, which is not supposed to happen when using root entities.
How could the datastore provide both transactional uniqueness of
key_names across root entities and transactional independence for root
entities? Its a paradox.
Calling db.run_in_transaction(txn, 'foobar') concurrently must produce
write contention somewhere correct?
What are the implications? Does that mean there could be write
contention anytime you create a root entity with a key_name? Does
that mean the only way to avoid write contention on insert is to use
auto IDs?
Can you clarify how it works under the covers?
Thanks,
Robin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" 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?hl=en
-~----------~----~----~----~------~----~------~--~---