[Zodb-checkins] SVN: ZODB/trunk/src/ Fixed a bug in mapping storage that caused hangs in transactions after

Jim Fulton jim at zope.com
Fri Oct 31 11:05:59 EDT 2008


Log message for revision 92733:
  Fixed a bug in mapping storage that caused hangs in transactions after
  empty transactions.
  

Changed:
  U   ZODB/trunk/src/CHANGES.txt
  U   ZODB/trunk/src/ZODB/MappingStorage.py
  U   ZODB/trunk/src/ZODB/tests/BasicStorage.py

-=-
Modified: ZODB/trunk/src/CHANGES.txt
===================================================================
--- ZODB/trunk/src/CHANGES.txt	2008-10-31 14:25:28 UTC (rev 92732)
+++ ZODB/trunk/src/CHANGES.txt	2008-10-31 15:05:57 UTC (rev 92733)
@@ -5,6 +5,9 @@
 3.9.0a2 (2008-??-??)
 ====================
 
+New Features
+------------
+
 - The connection now estimates the object size based on its pickle size
   and informs the cache about size changes.
 
@@ -19,6 +22,12 @@
   XXX There are known issues with this implementation that need to be
   sorted out before it is "released".
 
+Bug Fixes
+---------
+
+- MappingStorage hung when committing a transaction *after* committing
+  an empty transaction.
+
 3.9.0a1 (2008-10-29)
 ====================
 

Modified: ZODB/trunk/src/ZODB/MappingStorage.py
===================================================================
--- ZODB/trunk/src/ZODB/MappingStorage.py	2008-10-31 14:25:28 UTC (rev 92732)
+++ ZODB/trunk/src/ZODB/MappingStorage.py	2008-10-31 15:05:57 UTC (rev 92733)
@@ -286,7 +286,7 @@
     # ZODB.interfaces.IStorage
     @ZODB.utils.locked(opened)
     def tpc_finish(self, transaction, func = lambda tid: None):
-        if (transaction is not self._transaction) or not self._tdata:
+        if (transaction is not self._transaction):
             return
 
         tid = self._tid

Modified: ZODB/trunk/src/ZODB/tests/BasicStorage.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/BasicStorage.py	2008-10-31 14:25:28 UTC (rev 92732)
+++ ZODB/trunk/src/ZODB/tests/BasicStorage.py	2008-10-31 15:05:57 UTC (rev 92733)
@@ -183,3 +183,19 @@
     def checkInterfaces(self):
         for iface in zope.interface.providedBy(self._storage):
             zope.interface.verify.verifyObject(iface, self._storage)
+
+    def checkMultipleEmptyTransactions(self):
+        # There was a bug in handling empty transactions in mapping
+        # storage that caused the commit lock not to be released. :(
+        transaction.begin()
+        t = transaction.get()
+        self._storage.tpc_begin(t)
+        self._storage.tpc_vote(t)
+        self._storage.tpc_finish(t)
+        t.commit()
+        transaction.begin()
+        t = transaction.get()
+        self._storage.tpc_begin(t)      # Hung here before
+        self._storage.tpc_vote(t)
+        self._storage.tpc_finish(t)
+        t.commit()



More information about the Zodb-checkins mailing list