[Zope3-checkins] CVS: ZODB4/src/zodb/zeo/tests - invalid.py:1.1.2.4

Jeremy Hylton jeremy@zope.com
Thu, 19 Jun 2003 17:34:56 -0400


Update of /cvs-repository/ZODB4/src/zodb/zeo/tests
In directory cvs.zope.org:/tmp/cvs-serv14881

Modified Files:
      Tag: ZODB3-2-merge
	invalid.py 
Log Message:
Move the DB() open calls to after the tree creation transaction.

On occasion, more often with one particular storage, these tests would
fail because the second DB or Connection would not process its
invalidations until the test was over.  Probably exacerbated by all
the threads running flat out to add keys.

Haven't seen any of the "no added keys" test failures since making
this change.


=== ZODB4/src/zodb/zeo/tests/invalid.py 1.1.2.3 => 1.1.2.4 ===
--- ZODB4/src/zodb/zeo/tests/invalid.py:1.1.2.3	Thu Jun 19 11:35:36 2003
+++ ZODB4/src/zodb/zeo/tests/invalid.py	Thu Jun 19 17:34:55 2003
@@ -129,8 +129,7 @@
             try:
                 tree = cn.root()["tree"]
                 break
-            except (ConflictError, KeyError):
-                get_transaction().abort()
+            except (ConflictError, KeyError), msg:
                 cn.sync()
         while not self.stop.isSet():
             try:
@@ -220,13 +219,13 @@
         self._storage = storage1 = self.openClientStorage()
         storage2 = self.openClientStorage(cache="2")
         db1 = DB(storage1)
-        db2 = DB(storage2)
         stop = threading.Event()
 
         cn = db1.open()
         tree = cn.root()["tree"] = OOBTree()
         get_transaction().commit()
 
+        db2 = DB(storage2)
         # Run two threads that update the BTree
         t1 = StressThread(self, db1, stop, 1, 1)
         t2 = StressThread(self, db2, stop, 2, 2)
@@ -292,13 +291,14 @@
     def testConcurrentUpdatesInVersions(self):
         self._storage = storage1 = self.openClientStorage()
         db1 = DB(storage1)
-        db2 = DB(self.openClientStorage(cache="2"))
         stop = threading.Event()
 
         cn = db1.open()
         tree = cn.root()["tree"] = OOBTree()
         get_transaction().commit()
+        cn.close()
 
+        db2 = DB(self.openClientStorage(cache="2"))
         # Run three threads that update the BTree.
         # Two of the threads share a single storage so that it
         # is possible for both threads to read the same object
@@ -309,7 +309,7 @@
         t3 = VersionStressThread(self, db2, stop, 3, 3, 3, 0.001)
         self.go(stop, t1, t2, t3)
 
-        cn.sync()
+        cn = db1.open()
         self._check_tree(cn, tree)
         self._check_threads(tree, t1, t2, t3)