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

Barry Warsaw barry@wooz.org
Fri, 22 Nov 2002 17:23:56 -0500


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

Modified Files:
	Full.py 
Log Message:
Refactoring.

close(): The base class can now do all the work of closing, including
stopping the background threads.

log(): Much more convenient.


=== ZODB3/bsddb3Storage/bsddb3Storage/Full.py 1.54 => 1.55 ===
--- ZODB3/bsddb3Storage/bsddb3Storage/Full.py:1.54	Tue Nov 19 15:13:54 2002
+++ ZODB3/bsddb3Storage/bsddb3Storage/Full.py	Fri Nov 22 17:23:55 2002
@@ -33,7 +33,6 @@
 from ZODB.referencesf import referencesf
 from ZODB.TimeStamp import TimeStamp
 from ZODB.ConflictResolution import ConflictResolvingStorage, ResolvedSerial
-import zLOG
 
 # BerkeleyBase.BerkeleyBase class provides some common functionality for both
 # the Full and Minimal implementations.  It in turn inherits from
@@ -296,24 +295,6 @@
         else:
             self.__ltid = ZERO
 
-    def close(self):
-        # Set this flag before acquiring the lock so we don't block waiting
-        # for the autopack thread to give up the lock.
-        self._stop = True
-        self._lock_acquire()
-        try:
-            # We must stop the autopacker and checkpointing threads first
-            # before closing any tables.  I'm not sure about the join()
-            # timeout, but I'd be surprised if any particular iteration of a
-            # pack-related loops take longer than a few seconds.
-            if self._autopacker:
-                zLOG.LOG('Full storage', zLOG.INFO, 'stopping autopack thread')
-                self._autopacker.stop()
-                self._autopacker.join(30)
-            BerkeleyBase.close(self)
-        finally:
-            self._lock_release()
-
     def _doabort(self, txn, tid):
         # First clean up the oid indexed (or oid+tid indexed) tables.
         co = cs = ct = cv = None
@@ -1350,7 +1331,7 @@
         # to pass that around to the helper methods, so just assert they're
         # the same.
         assert zreferencesf == referencesf
-        zLOG.LOG('Full storage', zLOG.INFO, 'classic pack started')
+        self.log('classic 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()
@@ -1362,7 +1343,7 @@
             self._dopack(t)
         finally:
             self._packlock.release()
-        zLOG.LOG('Full storage', zLOG.INFO, 'classic pack finished')
+        self.log('classic pack finished')
 
     def _dopack(self, t, gc=True):
         # t is a TimeTime, or time float, convert this to a TimeStamp object,
@@ -1420,9 +1401,8 @@
         Autopacking is different than classic pack() in that it doesn't do
         cyclic garbage detection unless the gc flag is True.
         """
-        zLOG.LOG('Full storage', zLOG.INFO,
-                 'autopack started (packtime: %s, gc? %s)'
-                 % (t, gc and 'yes' or 'no'))
+        self.log('autopack started (packtime: %s, gc? %s)', t,
+                 (gc and 'yes' or 'no'))
         # 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()
@@ -1434,7 +1414,7 @@
             self._dopack(t, gc)
         finally:
             self._packlock.release()
-        zLOG.LOG('Full storage', zLOG.INFO, 'autopack finished')
+        self.log('autopack finished')
 
     def _collect_revs(self, txn, packtid):
         ct = co = None