Snapshot Isolation provided by MVCC allows for `write skew` effects

Bug #121437 reported by Christian Theune on 2007-06-20
Affects Status Importance Assigned to Milestone

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:
            self.set = OOSet()

    def remove(self, x):
        if self.set is None:
        if x in self.set:
            if len(self.set) == 1:
                self.set = None

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):

It's worth noting that most databases have the same property, at
least in their default configuration.


Changed in zodb:
importance: Undecided → Wishlist
status: New → Confirmed
Christian Theune (ctheune) wrote :

Here's a posting with some information how PostgreSQL approaches this:

Christian Theune (ctheune) wrote :

Benji gave this URL for more information on possible solution strategies:

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers