[Zodb-checkins] CVS: ZODB3/ZODB/FileStorage -
FileStorage.py:1.1.2.14
Jeremy Hylton
cvs-admin at zope.org
Sat Nov 22 00:05:50 EST 2003
Update of /cvs-repository/ZODB3/ZODB/FileStorage
In directory cvs.zope.org:/tmp/cvs-serv27082/ZODB/FileStorage
Modified Files:
Tag: ZODB3-mvcc-2-branch
FileStorage.py
Log Message:
Fix loadNonCurrent() for the abort version case,
but add an optimization that avoids seek+read for the txn header for
cases where it is safe to just use the serialno.
=== ZODB3/ZODB/FileStorage/FileStorage.py 1.1.2.13 => 1.1.2.14 ===
--- ZODB3/ZODB/FileStorage/FileStorage.py:1.1.2.13 Thu Nov 20 16:01:10 2003
+++ ZODB3/ZODB/FileStorage/FileStorage.py Sat Nov 22 00:05:45 2003
@@ -542,7 +542,7 @@
pos = self._lookup_pos(oid)
h = self._read_data_header(pos, oid)
if h.version and h.version != version:
- # Retrun data and serial from pnv (non-version data).
+ # Return data and serial from pnv (non-version data).
# If we return the old record's transaction id, then
# it will look to the cache like old data is current.
@@ -603,11 +603,29 @@
end_tid = None
while True:
h = self._read_data_header(pos, oid)
- # XXX abort version?
- if h.serial < tid and not h.version:
- break
+ # Is this the first data record written before tid?
+ #
+ # In most cases, we can just use the serial number which
+ # is more efficient. In the presence of abort version,
+ # the record's serial number will be the tid of the old
+ # non-version txn. So we can only use the serial test
+ # if there is no backpointer; abortVersion always writes
+ # a backpointer.
+
+ # The logic is a bit complicated, so explicitly track
+ # whether we need to read the txn header.
+ th = None
+ if not h.version:
+ if not h.back:
+ if h.serial < tid:
+ break
+ else:
+ th = self._read_txn_header(h.tloc)
+ if th.tid < tid:
+ break
+ if th is None:
+ th = self._read_txn_header(h.tloc)
pos = h.prev
- th = self._read_txn_header(h.tloc)
end_tid = th.tid
if not pos:
return None
More information about the Zodb-checkins
mailing list