[Zodb-checkins] CVS: ZODB3/ZODB - Transaction.py:1.39.16.5
Jeremy Hylton
jeremy@zope.com
Fri, 1 Nov 2002 17:33:35 -0500
Update of /cvs-repository/ZODB3/ZODB
In directory cvs.zope.org:/tmp/cvs-serv10571/ZODB
Modified Files:
Tag: ZODB3-deadlock-debug-branch
Transaction.py
Log Message:
Fallback to id() if jar doesn't define sortKey().
We can't prevent deadlock in these cases, but it's better to have
transacted and lost than never to have transacted at all.
=== ZODB3/ZODB/Transaction.py 1.39.16.4 => 1.39.16.5 ===
--- ZODB3/ZODB/Transaction.py:1.39.16.4 Fri Nov 1 17:07:34 2002
+++ ZODB3/ZODB/Transaction.py Fri Nov 1 17:33:35 2002
@@ -19,7 +19,7 @@
import time, sys, struct, POSException
from struct import pack
from string import split, strip, join
-from zLOG import LOG, ERROR, PANIC, INFO, BLATHER
+from zLOG import LOG, ERROR, PANIC, INFO, BLATHER, WARNING
from POSException import ConflictError
from ZODB import utils
@@ -33,7 +33,19 @@
def jar_cmp(j1, j2):
# Call sortKey() every time, because a ZEO client could reconnect
# to a different server at any time.
- return cmp(j1.sortKey(), j2.sortKey())
+ try:
+ k1 = j1.sortKey()
+ except:
+ LOG("TM", WARNING, "jar missing sortKey() method: %s" % j1)
+ k1 = id(j1)
+
+ try:
+ k2 = j2.sortKey()
+ except:
+ LOG("TM", WARNING, "jar missing sortKey() method: %s" % j2)
+ k2 = id(j2)
+
+ return cmp(k1, k2)
class Transaction:
'Simple transaction objects for single-threaded applications.'