[Zodb-checkins] SVN: ZODB/branches/3.3/ Port from Zope 2.7 branch.

Tim Peters tim.one at comcast.net
Mon Apr 4 22:30:09 EDT 2005


Log message for revision 29878:
  Port from Zope 2.7 branch.
  
  The various flavors of the ``check2ZODBThreads`` and ``check7ZODBThreads``
  tests are much less likely to suffer sproadic failures now.
  

Changed:
  U   ZODB/branches/3.3/NEWS.txt
  U   ZODB/branches/3.3/src/ZODB/tests/MTStorage.py

-=-
Modified: ZODB/branches/3.3/NEWS.txt
===================================================================
--- ZODB/branches/3.3/NEWS.txt	2005-04-05 00:35:58 UTC (rev 29877)
+++ ZODB/branches/3.3/NEWS.txt	2005-04-05 02:30:07 UTC (rev 29878)
@@ -1,3 +1,14 @@
+What's new in ZODB3 3.3.1?
+==========================
+Release date: DD-MMM-2005
+
+Tests
+-----
+
+The various flavors of the ``check2ZODBThreads`` and ``check7ZODBThreads``
+tests are much less likely to suffer sproadic failures now.
+
+
 What's new in ZODB3 3.3.1c1?
 ============================
 Release date: 01-Apr-2005

Modified: ZODB/branches/3.3/src/ZODB/tests/MTStorage.py
===================================================================
--- ZODB/branches/3.3/src/ZODB/tests/MTStorage.py	2005-04-05 00:35:58 UTC (rev 29877)
+++ ZODB/branches/3.3/src/ZODB/tests/MTStorage.py	2005-04-05 02:30:07 UTC (rev 29878)
@@ -75,23 +75,33 @@
         transaction.commit()
         time.sleep(self.delay)
 
+    # Return a new PersistentMapping, and store it on the root object under
+    # the name (.getName()) of the current thread.
     def get_thread_dict(self, root):
+        # This is vicious:  multiple threads are slamming changes into the
+        # root object, then trying to read the root object, simultaneously
+        # and without any coordination.  Conflict errors are rampant.  It
+        # used to go around at most 10 times, but that fairly often failed
+        # to make progress in the 7-thread tests on some test boxes.  Going
+        # around (at most) 1000 times was enough so that a 100-thread test
+        # reliably passed on Tim's hyperthreaded WinXP box (but at the
+        # original 10 retries, the same test reliably failed with 15 threads).
         name = self.getName()
-        # arbitrarily limit to 10 re-tries
-        for i in range(10):
+        MAXRETRIES = 1000
+
+        for i in range(MAXRETRIES):
             try:
-                m = PersistentMapping()
-                root[name] = m
-                transaction.commit()
+                root[name] = PersistentMapping()
+                get_transaction().commit()
                 break
-            except ConflictError, err:
-                transaction.abort()
+            except ConflictError:
                 root._p_jar.sync()
-        for i in range(10):
+
+        for i in range(MAXRETRIES):
             try:
                 return root.get(name)
             except ConflictError:
-                transaction.abort()
+                root._p_jar.sync()
 
 class StorageClientThread(TestThread):
 



More information about the Zodb-checkins mailing list