[ZODB-Dev] deadlock prevention for ZODB3 / Zope 2.6

Jeremy Hylton jeremy@zope.com (Jeremy Hylton)
Tue, 19 Nov 2002 12:24:47 -0500


>>>>> "SA" == Steve Alexander <steve@cat-box.net> writes:

  >>
  >> We intend to include this change in Zope 2.6.1.  Note that the
  >> log message warns of a potential problem, but nothing should
  >> actually break.  It looks like ZPsycdopgDA's data manager
  >> (_p_jar) inherits from Shared.DC.ZRDB.TM.  It may be necessary to
  >> add a sortKey() method to this base class.
  >>
  >> My one worry is that it probably isn't possible to pick a good
  >> sortKey() in the base class.

  SA> Why not just the string of the object id?

  SA> The sortKeys only have to be valid over the course of one
  SA> transaction, right?

No.  If a system is using more than one jar, then the sort keys need
to uniquely identify the jars in an order that will remain valid
across all transactions.  If the jars are zeo clients, then all zeo
clients need to have the same sort key.  If a DA locks during 2PC and
there is more than one database client, you've got the same problem.

The transaction code falls back to id() if there's nothing better, but
it can't prevent deadlock if it's using id().  It would be better if
there was something that uniquely identified the database it was
talking to.  ZEO uses server IP address and port.

Jeremy