[Zodb-checkins] CVS: ZODB3/bsddb3Storage/bsddb3Storage - Full.py:1.53
Barry Warsaw
barry@wooz.org
Fri, 15 Nov 2002 12:37:18 -0500
Update of /cvs-repository/ZODB3/bsddb3Storage/bsddb3Storage
In directory cvs.zope.org:/tmp/cvs-serv4151
Modified Files:
Full.py
Log Message:
_dorecovery(), _finish(), lastTransaction(): Add support for this
method which is required by recovery. We can initialize the last tid
from the txnoids table, and then keep it updated in _finish().
=== ZODB3/bsddb3Storage/bsddb3Storage/Full.py 1.52 => 1.53 ===
--- ZODB3/bsddb3Storage/bsddb3Storage/Full.py:1.52 Thu Nov 14 13:50:52 2002
+++ ZODB3/bsddb3Storage/bsddb3Storage/Full.py Fri Nov 15 12:37:18 2002
@@ -280,14 +280,28 @@
else:
self._withtxn(self._docommit, tid)
# Initialize our cache of the next available version id.
- record = self._versions.cursor().last()
- if record:
+ c = self._versions.cursor()
+ try:
+ rec = c.last()
+ finally:
+ c.close()
+ if rec:
# Convert to a Python long integer. Note that cursor.last()
# returns key/value, and we want the key (which for the
# versions table is the vid).
- self.__nextvid = U64(record[0])
+ self.__nextvid = U64(rec[0])
else:
self.__nextvid = 0L
+ # Initialize the last transaction
+ c = self._txnoids.cursor()
+ try:
+ rec = c.last()
+ finally:
+ c.close()
+ if rec:
+ self.__ltid = rec[0]
+ else:
+ self.__ltid = ZERO
def close(self):
# We must stop the autopacker first before closing any tables. BAW:
@@ -483,6 +497,7 @@
def _finish(self, tid, u, d, e):
self._pending[self._serial] = COMMIT
self._withtxn(self._docommit, self._serial)
+ self.__ltid = tid
#
# Storing an object revision in a transaction
@@ -1053,6 +1068,10 @@
return ZERO
else:
assert False, 'too many packtimes'
+
+ def lastTransaction(self):
+ """Return transaction id for last committed transaction"""
+ return self.__ltid
#
# Transactional undo