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

Chris McDonough chrism@zope.com
19 Nov 2002 12:39:35 -0500


There's a storage in Zope named "TemporaryStorage" for sessioning.  Does
it need a sortKey method?  If so, what should its sortKey method return?

On Tue, 2002-11-19 at 12:24, Jeremy Hylton wrote:
> >>>>> "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
> 
> 
> 
> 
> _______________________________________________
> For more information about ZODB, see the ZODB Wiki:
> http://www.zope.org/Wikis/ZODB/
> 
> ZODB-Dev mailing list  -  ZODB-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zodb-dev