[Zope3-checkins] CVS: Zope3/src/zodb/storage - bdbminimal.py:1.4
Barry Warsaw
barry@wooz.org
Tue, 31 Dec 2002 12:12:28 -0500
Update of /cvs-repository/Zope3/src/zodb/storage
In directory cvs.zope.org:/tmp/cvs-serv26107
Modified Files:
bdbminimal.py
Log Message:
__collect_objs(): Never collect the root object.
_dopack(): Added an XXX about a potential race conditional that I need
to fix. I want to try to write a test case for that first, although
it'll be a little tricky.
=== Zope3/src/zodb/storage/bdbminimal.py 1.3 => 1.4 ===
--- Zope3/src/zodb/storage/bdbminimal.py:1.3 Mon Dec 30 17:38:52 2002
+++ Zope3/src/zodb/storage/bdbminimal.py Tue Dec 31 12:12:27 2002
@@ -370,6 +370,16 @@
self.log('classic pack finished')
def _dopack(self):
+ # XXX There is a potential race condition here that we need to address
+ # so we don't lose objects. Say we've just completed the mark phase
+ # and another thread comes along and stores an object. Now we enter
+ # the sweep phase and notice that that other object isn't in the
+ # marked list. So we add it to the collection list. Full is less
+ # vulnerable to this hole (although it's still there) because it
+ # usually won't pack all the way to the current time. I want to try
+ # to write a test case for this situation before I fix it, but that's
+ # difficult without instrumenting _dopack() for testing.
+ #
# Do a mark and sweep for garbage collection. Calculate the set of
# objects reachable from the root. Anything else is a candidate for
# having all their revisions packed away. The set of reachable
@@ -455,6 +465,10 @@
if self._stop:
raise PackStop, 'stopped in _collect_objs()'
oid = orec[1]
+ # Never pack away the root object.
+ if oid == ZERO:
+ orec = self._oidqueue.consume(txn)
+ continue
# Delete the object from the serials table
c = self._serials.cursor(txn)
try: