[ZODB-Dev] RelStorage 1.5.0b1 dry-run > two phase pack, better pack lock behaviour

Martijn Pieters mj at zopatista.com
Wed Feb 23 09:08:38 EST 2011


On Tue, Feb 22, 2011 at 21:41, Martijn Pieters <mj at 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


More information about the ZODB-Dev mailing list