[Zodb-checkins] CVS: ZODB3/bsddb3Storage/bsddb3Storage - Full.py:1.51

Barry Warsaw barry@wooz.org
Mon, 11 Nov 2002 17:05:41 -0500


Update of /cvs-repository/ZODB3/bsddb3Storage/bsddb3Storage
In directory cvs.zope.org:/tmp/cvs-serv29520

Modified Files:
	Full.py 
Log Message:
_collect_objs(), _mark(): Fix some problems that cropped up in the
cycle deletion tests.


=== ZODB3/bsddb3Storage/bsddb3Storage/Full.py 1.50 => 1.51 ===
--- ZODB3/bsddb3Storage/bsddb3Storage/Full.py:1.50	Mon Nov 11 15:57:37 2002
+++ ZODB3/bsddb3Storage/bsddb3Storage/Full.py	Mon Nov 11 17:05:41 2002
@@ -1504,7 +1504,10 @@
             # Delete the object from the serials table
             c = self._serials.cursor(txn)
             try:
-                rec = c.set(oid)
+                try:
+                    rec = c.set(oid)
+                except db.DBNotFoundError:
+                    rec = None
                 while rec and rec[0] == oid:
                     c.delete()
                     rec = c.next_dup()
@@ -1520,7 +1523,10 @@
             # Collect all metadata records for this object
             c = self._metadata.cursor(txn)
             try:
-                rec = c.set_range(oid)
+                try:
+                    rec = c.set_range(oid)
+                except db.DBNotFoundError:
+                    rec = None
                 while rec and rec[0][:8] == oid:
                     revid, metadata = rec
                     tid = revid[8:]
@@ -1593,25 +1599,26 @@
         # root references, and then for each of those, find all the objects it
         # references, and so on until we've traversed the entire object graph.
         while oid:
-            if self._packmark.has_key(oid):
-                # We've already seen this object
-                continue
-            self._packmark.put(oid, PRESENT, txn=txn)
-            # Get the pickle data for the most current revision of this object
-            # as of the pack time.
-            tid = self._findrev(oid, packtid, txn)
-            # Say there's no root object (as is the case in some of the unit
-            # tests), and we're looking up oid ZERO.  Then serial will be None.
-            if tid is not None:
-                lrevid = self._metadata[oid+tid][16:24]
-                data = self._pickles[oid+lrevid]
-                # Now get the oids of all the objects referenced by this pickle
-                refdoids = []
-                referencesf(data, refdoids)
-                # And append them to the queue for later
-                for oid in refdoids:
-                    self._oidqueue.append(oid, txn)
-                # Pop the next oid off the queue and do it all again
+            if not self._packmark.has_key(oid):
+                # We haven't seen this object yet
+                self._packmark.put(oid, PRESENT, txn=txn)
+                # Get the pickle data for the most current revision of this
+                # object as of the pack time.
+                tid = self._findrev(oid, packtid, txn)
+                # Say there's no root object (as is the case in some of the
+                # unit tests), and we're looking up oid ZERO.  Then serial
+                # will be None.
+                if tid is not None:
+                    lrevid = self._metadata[oid+tid][16:24]
+                    data = self._pickles[oid+lrevid]
+                    # Now get the oids of all the objects referenced by this
+                    # pickle
+                    refdoids = []
+                    referencesf(data, refdoids)
+                    # And append them to the queue for later
+                    for oid in refdoids:
+                        self._oidqueue.append(oid, txn)
+            # Pop the next oid off the queue and do it all again
             rec = self._oidqueue.consume()
             oid = rec and rec[1]
         assert len(self._oidqueue) == 0