[Zodb-checkins] CVS: ZODB3/bsddb3Storage/bsddb3Storage - Minimal.py:1.12.4.3

Barry Warsaw barry@wooz.org
Wed, 11 Sep 2002 18:53:16 -0400


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

Modified Files:
      Tag: bdb-nolocks
	Minimal.py 
Log Message:
_docommit(), _update_refcounts(): Get rid of the recursion.


=== ZODB3/bsddb3Storage/bsddb3Storage/Minimal.py 1.12.4.2 => 1.12.4.3 ===
--- ZODB3/bsddb3Storage/bsddb3Storage/Minimal.py:1.12.4.2	Wed Sep 11 14:10:32 2002
+++ ZODB3/bsddb3Storage/bsddb3Storage/Minimal.py	Wed Sep 11 18:53:16 2002
@@ -178,8 +178,8 @@
         # Now, to finish up, we need apply the refcount deltas to the
         # refcounts table, and do recursive collection of all refcount == 0
         # objects.
-        if deltas:
-            self._update_refcounts(deltas, txn)
+        while deltas:
+            deltas = self._update_refcounts(deltas, txn)
 
     def _update_refcounts(self, deltas, txn):
         newdeltas = {}
@@ -202,10 +202,9 @@
                 self._pickles.delete(oid+current, txn=txn)
             else:
                 self._refcounts.put(oid, p64(rc), txn=txn)
-        # Now we need to recurse for any objects referenced by pickles just
-        # deleted in this round.
-        if newdeltas:
-            self._update_refcounts(newdeltas, txn)
+        # Return the list of objects referenced by pickles just deleted in
+        # this round, for decref'ing on the next go 'round.
+        return newdeltas
 
     def _begin(self, tid, u, d, e):
         # When a transaction begins, we set the pending flag to ABORT,