[Zodb-checkins] CVS: ZODB3/bsddb3Storage/bsddb3Storage - Full.py:1.44.2.2
Barry Warsaw
barry@wooz.org
Mon, 23 Sep 2002 23:41:31 -0400
Update of /cvs-repository/ZODB3/bsddb3Storage/bsddb3Storage
In directory cvs.zope.org:/tmp/cvs-serv12427
Modified Files:
Tag: bdb-nolocks
Full.py
Log Message:
Another checkpoint. Still to do:
- undoLog()
- history()
- pack()
- iterator()
Also, autopack() and verifying the cyclic garbage collector
=== ZODB3/bsddb3Storage/bsddb3Storage/Full.py 1.44.2.1 => 1.44.2.2 === (1077/1177 lines abridged)
--- ZODB3/bsddb3Storage/bsddb3Storage/Full.py:1.44.2.1 Thu Sep 19 18:11:17 2002
+++ ZODB3/bsddb3Storage/bsddb3Storage/Full.py Mon Sep 23 23:41:30 2002
@@ -18,9 +18,9 @@
__version__ = '$Revision$'.split()[-2:][0]
import sys
-import struct
import time
import cPickle as pickle
+from struct import pack, unpack
# This uses the Dunn/Kuchling PyBSDDB v3 extension module available from
# http://pybsddb.sourceforge.net. It is compatible with release 3.4 of
@@ -49,6 +49,9 @@
UNDOABLE_TRANSACTION = 'Y'
PROTECTED_TRANSACTION = 'N'
+ABORT = 'A'
+COMMIT = 'C'
+PRESENT = 'X'
ZERO = '\0'*8
DNE = '\377'*8
# DEBUGGING
@@ -260,13 +263,10 @@
self._pickleRefcounts.close()
BerkeleyBase.close(self)
- def _do(self, meth, tid):
+ def _do(self, meth, tid, *args):
txn = self._env.txn_begin()
try:
- meth(tid, txn)
- self._oids.truncate(txn)
- self._pvids.truncate(txn)
- self._pending.truncate(txn)
+ return meth(tid, txn, *args)
except:
txn.abort()
self._docheckpoint()
@@ -329,23 +329,28 @@
self._vids.delete(version, txn=txn)
finally:
cv.close()
- # Now clean up the tid indexed table.
+ # Now clean up the tid indexed table, and the log tables
self._txnMetadata.delete(tid, txn=txn)
+ self._oids.truncate(txn)
+ self._pvids.truncate(txn)
+ self._pending.truncate(txn)
[-=- -=- -=- 1077 lines omitted -=- -=- -=-]
+
def _rootreachable(self, referencesf):
# Quick exit for empty storages
if not self._serials:
@@ -1406,6 +1365,8 @@
self._zapobject(oid, decrefoids, referencesf)
def pack(self, t, referencesf):
+ # XXX log pack starts and stops
+
# A simple wrapper around the bulk of packing, but which acquires a
# lock that prevents multiple packs from running at the same time.
self._packlock.acquire()
@@ -1414,11 +1375,10 @@
finally:
self._packlock.release()
- # GCable interface, for cyclic garbage collection
#
- # BAW: Note that the GCable interface methods are largely untested.
- # Support for these is off the table for the 1.0 release of the Berkeley
- # storage.
+ # GCable interface, for cyclic garbage collection (untested)
+ #
+
def gcTrash(oids):
"""Given a list of oids, treat them as trash.
@@ -1484,8 +1444,10 @@
c.close()
self._lock_release()
- # Fail-safe `iterator' interface, used to copy and analyze storage
- # transaction data.
+ #
+ # Iterator protocol
+ #
+
def iterator(self):
"""Get a transactions iterator for the storage."""
return _TransactionsIterator(self)
@@ -1513,7 +1475,7 @@
# Now unpack the necessary information. Don't impedence match the
# status flag (that's done by the caller).
status = data[0]
- userlen, desclen = struct.unpack('>II', data[1:9])
+ userlen, desclen = unpack('>II', data[1:9])
user = data[9:9+userlen]
desc = data[9+userlen:9+userlen+desclen]
ext = data[9+userlen+desclen:]