Commit c22d1701 authored by Jeremy Hylton's avatar Jeremy Hylton

Handle abortVersion() correctly with all versions of ZODB.

Different versions of ZODB do different things with the serialnos for
abortVersion().  To be safe and avoid giving non-version data with an
invalid serialno after an abort version, invalidate the version and
non-version data.

This hurts cache effectiveness when a version is aborted, but I expect
it will have little practical impact.
parent 8927a15e
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
############################################################################## ##############################################################################
"""Network ZODB storage client """Network ZODB storage client
$Id: ClientStorage.py,v 1.55 2002/09/08 00:20:20 jeremy Exp $ $Id: ClientStorage.py,v 1.56 2002/09/09 18:34:03 jeremy Exp $
""" """
# XXX TO DO # XXX TO DO
...@@ -243,8 +243,17 @@ class ClientStorage: ...@@ -243,8 +243,17 @@ class ClientStorage:
def abortVersion(self, src, transaction): def abortVersion(self, src, transaction):
self._check_trans(transaction) self._check_trans(transaction)
oids = self._server.abortVersion(src, self._serial) oids = self._server.abortVersion(src, self._serial)
# When a version aborts, invalidate the version and
# non-version data. The non-version data should still be
# valid, but older versions of ZODB will change the
# non-version serialno on an abort version. With those
# versions of ZODB, you'd get a conflict error if you tried to
# commit a transaction with the cached data.
# XXX If we could guarantee that ZODB gave the right answer,
# we could just invalidate the version data.
for oid in oids: for oid in oids:
self._tbuf.invalidate(oid, src) self._tbuf.invalidate(oid, '')
return oids return oids
def commitVersion(self, src, dest, transaction): def commitVersion(self, src, dest, transaction):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment