Re: src/backend/storage/lmgr/lock.c ----> LockAcquire()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "S -" <nat_lazy(at)hotmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: src/backend/storage/lmgr/lock.c ----> LockAcquire()
Date: 2003-04-24 13:09:57
Message-ID: 12931.1051189797@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"S -" <nat_lazy(at)hotmail(dot)com> writes:
> -- Within a SINGLE call of LockAcquire, is it possible for GrantLock() to be
> called multiple times?

Hmm. In the normal course of events, a LockAcquire would only try to
grant the target lock to itself; it couldn't grant anything to anyone
else as a byproduct. But I think there might be corner cases involving
deadlock detection. Once a deadlock is detected, the resulting
transaction abort leads to lock releases which lead to lock grants
occurring --- so how narrowly are you defining "a single call of
LockAcquire"?

In any case a single call of LockRelease can certainly result in
multiple GrantLocks, so I'm not sure what sort of optimization you might
have in mind that would be feasible.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Treat 2003-04-24 13:33:19 putting new pdf docs on ftp site
Previous Message Rod Taylor 2003-04-24 13:06:37 Re: Are we losing momentum?