Fixed
Status Update
Comments
br...@google.com <br...@google.com> #2
The App Engine memcache servers support this already, but that part of the API's not
exposed to the Python and Java runtimes yet as it turns out (I thought they were :/).
It should be fairly straight-forward to add when somebody has some time.
I can't speak for the datastore, though.
exposed to the Python and Java runtimes yet as it turns out (I thought they were :/).
It should be fairly straight-forward to add when somebody has some time.
I can't speak for the datastore, though.
ka...@gmail.com <ka...@gmail.com> #3
Each time I try to write something shared on Memcache, I have to write some
(pessimmistic/optimistic) lock code by using MemcacheService#increment. It would be
very handy if Memcache provide the CAS API which can by used for detection of the
conflict. It would make my code much simpler...
(pessimmistic/optimistic) lock code by using MemcacheService#increment. It would be
very handy if Memcache provide the CAS API which can by used for detection of the
conflict. It would make my code much simpler...
ap...@google.com <ap...@google.com>
gu...@google.com <gu...@google.com> #4
Memcache CAS for Python will likely be released in APp Engine 1.5.3. (For Java it has already been released.)
I don't know about the datastore.
I don't know about the datastore.
ro...@gmail.com <ro...@gmail.com> #5
As Jon noted, if I'm not mistaken, we can simulate CAS in the datastore with transactions.
gu...@google.com <gu...@google.com> #6
Then I propose to close this once 1.5.3 is out (with the CAS changes for memcache). I don't think anything needs to be added to the datastore.
pr...@google.com <pr...@google.com> #7
1.5.3 Release Note:
Python Updates
Memcache API - We now support the CAS (compare-and-swap) operation in our Python Memcache API (Java already had it). This can be used to update a value in Memcache only if no other requests have updated it between when the value was retrieved and when you go to update it.
Python Updates
Memcache API - We now support the CAS (compare-and-swap) operation in our Python Memcache API (Java already had it). This can be used to update a value in Memcache only if no other requests have updated it between when the value was retrieved and when you go to update it.
ni...@gmail.com <ni...@gmail.com> #9
Some examples of usage are appreciated.
ni...@gmail.com <ni...@gmail.com> #11
Thank you very much. I am new subscriber now.
mc...@gmail.com <mc...@gmail.com> #12
[Comment deleted]
Description
DB and memcache for edits. The usual pattern is:
1. Read and update value in DB, in a transaction
# RACE!!!
2. Overwrite the value in memcache
So, if two edits on the DB are running in parallel, it's technically
possible for DB edits to complete in one order, while memcache edits are
applied in a different order, leading to long lasting memcache/DB inconsistency
If we had CAS on both the data store and memcache, we could fix the race
condition in user land. And, we could write correct ordered updates across
entity groups.
CAS in the datastore would also simplify the entity creation pattern.
It's technically possible to write CAS in user space by adding a guid to
each model instance and using normal transactions. But, we can't add CAS to
memcache without help. And, built-in CAS for both systems would be nicer.