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

Tim Peters tim.one at comcast.net
Mon Apr 4 22:36:35 EDT 2005


Log message for revision 29879:
  Port from 3.3 branch.
  
  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.4/NEWS.txt
  U   ZODB/branches/3.4/src/ZODB/tests/MTStorage.py

-=-
Modified: ZODB/branches/3.4/NEWS.txt
===================================================================
--- ZODB/branches/3.4/NEWS.txt	2005-04-05 02:30:07 UTC (rev 29878)
+++ ZODB/branches/3.4/NEWS.txt	2005-04-05 02:36:33 UTC (rev 29879)
@@ -1,3 +1,14 @@
+What's new in ZODB3 3.4xx?
+==========================
+Release date: MM-DDD-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.4a2?
 ==========================
 Release date: 03-Apr-2005
@@ -132,6 +143,17 @@
 FileStorage indices.  Thanks to Chris McDonough for code and tests.
 
 
+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.4/src/ZODB/tests/MTStorage.py
===================================================================
--- ZODB/branches/3.4/src/ZODB/tests/MTStorage.py	2005-04-05 02:30:07 UTC (rev 29878)
+++ ZODB/branches/3.4/src/ZODB/tests/MTStorage.py	2005-04-05 02:36:33 UTC (rev 29879)
@@ -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
+                root[name] = PersistentMapping()
                 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