[Zodb-checkins] CVS: Zope3/src/zodb/storage/tests - packable.py:1.13

Tim Peters tim.one at comcast.net
Wed Jul 2 17:00:37 EDT 2003


Update of /cvs-repository/Zope3/src/zodb/storage/tests
In directory cvs.zope.org:/tmp/cvs-serv9770/src/zodb/storage/tests

Modified Files:
	packable.py 
Log Message:
BDBFullStorage():  Plug a pack hole by not aiding oids to packmark
during commit, but by holding the commit lock while computing the pack
time.  See new comments for details.  It was possible to garbage-
collect a reachable object before this.

hestPackNowWhileWriting():  A new variant of testPackWhileWriting(),
which packs to "now" instead of to some time in the past.  The full
storage hole was very much easier to stumble into this way.


=== Zope3/src/zodb/storage/tests/packable.py 1.12 => 1.13 ===
--- Zope3/src/zodb/storage/tests/packable.py:1.12	Fri May 16 18:53:47 2003
+++ Zope3/src/zodb/storage/tests/packable.py	Wed Jul  2 16:00:30 2003
@@ -238,7 +238,7 @@
 
         eq(root['obj'].value, 7)
 
-    def testPackWhileWriting(self):
+    def _PackWhileWriting(self, pack_now=False):
         # A storage should allow some reading and writing during
         # a pack.  This test attempts to exercise locking code
         # in the storage to test that it is safe.  It generates
@@ -263,7 +263,12 @@
         threads = [ClientThread(db) for i in range(4)]
         for t in threads:
             t.start()
-        db.pack(packt)
+
+        if pack_now:
+            db.pack(time.time())
+        else:
+            db.pack(packt)
+
         for t in threads:
             t.join(30)
         for t in threads:
@@ -280,6 +285,12 @@
             for data in txn:
                 pass
         iter.close()
+
+    def testPackWhileWriting(self):
+        self._PackWhileWriting(pack_now=False)
+
+    def testPackNowWhileWriting(self):
+        self._PackWhileWriting(pack_now=True)
 
 
 class ClientThread(threading.Thread):




More information about the Zodb-checkins mailing list