[Zodb-checkins] CVS: ZODB3/ZODB - DB.py:1.43.24.2 Connection.py:1.76.4.1.2.3

Jeremy Hylton jeremy@zope.com
Fri, 1 Nov 2002 16:15:22 -0500


Update of /cvs-repository/ZODB3/ZODB
In directory cvs.zope.org:/tmp/cvs-serv330

Modified Files:
      Tag: ZODB3-deadlock-debug-branch
	DB.py Connection.py 
Log Message:
Add id() to each jar's sortKey().

It's not sufficient to just use the storage key, because two different
connections could use the same storage in the same transaction.


=== ZODB3/ZODB/DB.py 1.43.24.1 => 1.43.24.2 ===
--- ZODB3/ZODB/DB.py:1.43.24.1	Fri Nov  1 14:22:33 2002
+++ ZODB3/ZODB/DB.py	Fri Nov  1 16:15:21 2002
@@ -577,8 +577,11 @@
         self.tpc_begin=s.tpc_begin
         self.tpc_vote=s.tpc_vote
         self.tpc_finish=s.tpc_finish
-        self.sortKey=s.sortKey
+        self._sortKey=s.sortKey
         get_transaction().register(self)
+
+    def sortKey(self):
+        return "%s:%s" % (self._sortKey(), id(self))
 
     def abort(self, reallyme, t): pass
 


=== ZODB3/ZODB/Connection.py 1.76.4.1.2.2 => 1.76.4.1.2.3 ===
--- ZODB3/ZODB/Connection.py:1.76.4.1.2.2	Fri Nov  1 14:42:15 2002
+++ ZODB3/ZODB/Connection.py	Fri Nov  1 16:15:21 2002
@@ -193,7 +193,11 @@
 
     def sortKey(self):
         # XXX will raise an exception if the DB hasn't been set
-        return self._sortKey()
+        storage_key = self._sortKey()
+        # If two connections use the same storage, give them a
+        # consistent order using id().  This is unique for the
+        # lifetime of a connection, which is good enough.
+        return "%s:%s" % (storage_key, id(self))
 
     def _setDB(self, odb):
         """Begin a new transaction.