Re: Revised Patch to allow multiple table locks in "Unison" - Mailing list pgsql-patches

From Fernando Nasser
Subject Re: Revised Patch to allow multiple table locks in "Unison"
Date
Msg-id 3B658856.C47EADAD@redhat.com
Whole thread Raw
In response to Re: Revised Patch to allow multiple table locks in "Unison"  (Neil Padgett <npadgett@redhat.com>)
List pgsql-patches
Hiroshi Inoue wrote:
>
> Is it paranoid to worry about the followings ?
>
> 1) Concurrent 'lock table a, b;' and 'lock table b, a;'
>    could last forever in theory ?

You would need a very evil timeslice duration on a single processor, but
it
could happen on a dual processor.  However, the two processes would have
to
be synchronized in a very narrow window of instructions, the schedulers
in
both machines would have to be precisely synchronized and absolutely no
interruption (that is not common to both machines) could never occur.
Even a keyboard press will break the enchantment.

I guess it is what we call "unstable equilibrium", possible in theory
but
never happens in practice except for an infinitesimal amount of time.
It is trying to make an egg stand on one end or something like that
(without breaking the egg, of course :-) ).



> 2) 'Lock table a,b' could hardly acquire the lock when
>    both the table a and b are very frequently accessed.
>

Yes, multiple locks with the back off is less aggressive than obtaining
and holding the locks (with individual lock commands).



--
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Add ANALYZE to tab complete in psql
Next
From: Randy Hall
Date:
Subject: Add ANALYZE to tab complete in psql