On Tue, Feb 22, 2011 at 21:41, Martijn Pieters <m...@zopatista.com> wrote:
> I'll look into working the locking idea into a patch too,
> but I'll need help with supporting Postgres and MySQL as I don't know
> their locking semantics.

Both MySQL and Oracle support lock timeouts and already use a timeout
for the commit lock. Postgresql has a 'NOWAIT' parameter for locking.

All that is needed then is a nowait=False keyword parameter for the
hold_commit_lock method. For Oracle and MySQL nowait=True simply means
that the timeout is set to 0, for Postgresql NOWAIT is added to the
LOCK TABLE statement.

In all cases, when nowait is True, I guess the method should return a
boolean flag to indicate a successful lock, not throw an exception.
Exceptions would work too but a boolean would make more sense here.

I've started a optimistic locking strategy patch in my patch queue,
contains this locking strategy change only for now:

  
https://bitbucket.org/mjpieters/relstorage-mq/src/tip/optimistic_commitlock_pack.patch

-- 
Martijn Pieters
_______________________________________________
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zodb-dev

Reply via email to