Snapshot Isolation provided by MVCC allows for `write skew` effects
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ZODB |
Confirmed
|
Wishlist
|
Unassigned |
Bug Description
The isolation level of ZODB only implements a relaxed version of the `Isolation` property of ACID.
Here is a sample where the serializability fails:
class X(object):
set = None
def add(self, x):
if self.set is None:
set.add(x)
def remove(self, x):
if self.set is None:
return
if x in self.set:
if len(self.set) == 1:
else:
Now, consider the two transactions T1, T2, and T3, first in parallel:
T1: begin()
T1: root['x'] = X()
T1: root['x'].add(1)
T1: commit()
T2: begin()
T3: begin()
T2: root['x'].remove(1)
T3: root['x'].add(2)
T2: commit()
T3: commit()
All transactions will commit successfully and the value of root['x'].set will be None.
If we look at the transactions if they ran serialized:
(Same for T1)
T2: begin()
T2: root['x'].remove(1)
T2: commit()
T3: begin()
T3: root['x'].add(2)
T3: commit()
Now, the result would be root['x'].set == set([2]).
Note: The initial discussion for this bug was spawned by this mailing list thread (in German, sorry): https:/
Changed in zodb: | |
importance: | Undecided → Wishlist |
status: | New → Confirmed |
It's worth noting that most databases have the same property, at
least in their default configuration.
Jim