[Zope-Checkins] CVS: ZODB/src/ZODB/tests - PackableStorage.py:1.35

Tim Peters tim.one at comcast.net
Fri Mar 12 21:49:23 EST 2004


Update of /cvs-repository/ZODB/src/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv9728/src/ZODB/tests

Modified Files:
	PackableStorage.py 
Log Message:
New (but disabled for now) test checkPackLotsWhileWriting reliably dies
with

    CorruptedError:  ... transaction with checkpoint flag set

on my box when doing the ZEO flavor of FileStorage.  This is like the
other pack-while-writing tests, but uses only 1 client thread that does
twice as much, and packs repeatedly for so long as that thread runs.  I
usually see it fail before the fourth pack attempt.


=== ZODB/src/ZODB/tests/PackableStorage.py 1.34 => 1.35 ===
--- ZODB/src/ZODB/tests/PackableStorage.py:1.34	Fri Mar 12 14:41:50 2004
+++ ZODB/src/ZODB/tests/PackableStorage.py	Fri Mar 12 21:49:22 2004
@@ -248,17 +248,66 @@
         if not hasattr(self._storage, "iterator"):
             return
 
-        iter = self._storage.iterator()
-        for txn in iter:
+        it = self._storage.iterator()
+        for txn in it:
             for data in txn:
                 pass
-        iter.close()
+        it.close()
 
     def checkPackWhileWriting(self):
         self._PackWhileWriting(pack_now=False)
 
     def checkPackNowWhileWriting(self):
         self._PackWhileWriting(pack_now=True)
+
+    # XXX Disabled because it always fails now.
+    def XXXcheckPackLotsWhileWriting(self):
+        # This is like the other pack-while-writing tests, except it packs
+        # repeatedly until the client thread is done.  At the time it was
+        # introduced, it reliably provoked
+        #     CorruptedError:  ... transaction with checkpoint flag set
+        # in the ZEO flavor of the FileStorage tests.
+
+        db = DB(self._storage)
+        conn = db.open()
+        root = conn.root()
+
+        choices = range(10)
+        for i in choices:
+            root[i] = MinPO(i)
+        get_transaction().commit()
+
+        snooze()
+        packt = time.time()
+
+        for dummy in choices:
+           for i in choices:
+               root[i].value = MinPO(i)
+               get_transaction().commit()
+
+        NUM_LOOP_TRIP = 100
+        timer = ElapsedTimer(time.time())
+        threads = [ClientThread(db, choices, NUM_LOOP_TRIP, timer, i)
+                   for i in range(1)]
+        for t in threads:
+            t.start()
+
+        while True in [t.isAlive() for t in threads]:
+            db.pack(packt)
+            snooze()
+            packt = time.time()
+
+        for t in threads:
+            t.join()
+
+        # Iterate over the storage to make sure it's sane.
+        if not hasattr(self._storage, "iterator"):
+            return
+        it = self._storage.iterator()
+        for txn in it:
+            for data in txn:
+                pass
+        it.close()
 
 class PackableUndoStorage(PackableStorageBase):
 




More information about the Zope-Checkins mailing list