[Zodb-checkins] CVS: ZODB3/BDBStorage - BDBFullStorage.py:1.75.2.9
Jeremy Hylton
jeremy at zope.com
Fri Dec 19 17:38:57 EST 2003
Update of /cvs-repository/ZODB3/BDBStorage
In directory cvs.zope.org:/tmp/cvs-serv22624
Modified Files:
Tag: ZODB3-mvcc-2-branch
BDBFullStorage.py
Log Message:
Fix loadSerial().
It's a bit of a hack because _loadSerialEx() is also used by the
iterator and it it needs to provide different results to each caller.
loadSerial() passes the want_version flag as False indicating that it
does not want version data returned.
This change gets all the tests passing.
=== ZODB3/BDBStorage/BDBFullStorage.py 1.75.2.8 => 1.75.2.9 ===
--- ZODB3/BDBStorage/BDBFullStorage.py:1.75.2.8 Tue Dec 2 11:34:47 2003
+++ ZODB3/BDBStorage/BDBFullStorage.py Fri Dec 19 17:38:55 2003
@@ -1035,7 +1035,7 @@
raise KeyError, 'Object does not exist: %r' % oid
return tid
- def _loadSerialEx(self, oid, serial):
+ def _loadSerialEx(self, oid, serial, want_version=True):
# Just like loadSerial, except that it returns the pickle data, the
# version this object revision is living in, and a backpointer. The
# backpointer is None if the lrevid for this metadata record is the
@@ -1046,27 +1046,30 @@
# Get the pointer to the pickle for the given serial number. Let
# KeyErrors percolate up.
metadata = self._metadata[oid+serial]
- vid, ign, lrevid = unpack('>8s8s8s', metadata[:24])
+ vid, nrevid, lrevid = unpack('>8s8s8s', metadata[:24])
if vid == ZERO:
version = ''
else:
version = self._versions[vid]
+ revid = lrevid
+ if not want_version and vid != ZERO:
+ revid = nrevid
# Check for an zombification event, possible with transactional
# undo. Use data==None to specify that.
- if lrevid == DNE:
+ if revid == DNE:
return None, version, None
backpointer = None
- if lrevid <> serial:
+ if revid != serial:
# This transaction shares its pickle data with a previous
# transaction. We need to let the caller know, esp. when it's
# the iterator code, so that it can pass this information on.
- backpointer = lrevid
- return self._pickles[oid+lrevid], version, backpointer
+ backpointer = revid
+ return self._pickles[oid+revid], version, backpointer
finally:
self._lock_release()
def loadSerial(self, oid, serial):
- return self._loadSerialEx(oid, serial)[0]
+ return self._loadSerialEx(oid, serial, want_version=False)[0]
def getTid(self, oid):
# Return the serial number for the current revision of this object,
More information about the Zodb-checkins
mailing list