[Zope3-checkins] CVS: ZODB4/src/zodb/storage - bdbminimal.py:1.9
Barry Warsaw
barry@wooz.org
Mon, 27 Jan 2003 11:26:04 -0500
Update of /cvs-repository/ZODB4/src/zodb/storage
In directory cvs.zope.org:/tmp/cvs-serv23033
Modified Files:
bdbminimal.py
Log Message:
_dostore(): Close another race condition, which can occur if a store
occurs between the mark and sweep phases.
=== ZODB4/src/zodb/storage/bdbminimal.py 1.8 => 1.9 ===
--- ZODB4/src/zodb/storage/bdbminimal.py:1.8 Fri Jan 24 13:54:50 2003
+++ ZODB4/src/zodb/storage/bdbminimal.py Mon Jan 27 11:26:00 2003
@@ -270,6 +270,12 @@
self._serials.put(oid, newserial, txn=txn)
self._pickles.put(oid+newserial, data, txn=txn)
self._oids.put(oid, PRESENT, txn=txn)
+ # If we're in the middle of a pack, we need to add these objects to
+ # the packmark, so a specific race condition won't collect them.
+ # E.g. we do a mark, then we do a store, then we sweep. The objects
+ # stored between the mark and sweep would get collected away.
+ if self._packing:
+ self._packmark.put(oid, PRESENT, txn=txn)
# Return the new serial number for the object
if conflictresolved:
return ResolvedSerial
@@ -360,7 +366,7 @@
#
def pack(self, t):
- self.log('classic pack started')
+ self.log('pack started')
# 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()
@@ -377,7 +383,7 @@
finally:
self._packing = False
self._packlock.release()
- self.log('classic pack finished')
+ self.log('pack finished')
def _dopack(self):
# Do a mark and sweep for garbage collection. Calculate the set of