Re: pgsql/src/backend/storage/lmgr (lmgr.c lock.c proc.c README)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql/src/backend/storage/lmgr (lmgr.c lock.c proc.c README)
Date: 2001-01-13 00:26:49
Message-ID: 23944.979345609@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

"Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp> writes:
>> The previously noted bug in ProcLockWakeup, that it
>> couldn't wake up
>> any waiters beyond the first non-wakeable waiter, is now fixed.

> I've just noticed that this changed a locking behabior.
> For example, VACUUM could hardly acquire the lock
> while other backends frequently access the target table.

Maybe so, but the old behavior was deadlock-prone. There are cases
in which you *must* wake up a process that's behind non-wakable
processes, or you will have a silent lockup. I've forgotten the
details, but I demonstrated such a case to myself while I was fixing
this code (I think it took four processes altogether, and two different
locks, to exhibit the problem).

HandleDeadlock is also willing to wake up processes that are not the
first in their queue, so there'd be no guarantee of first-in-first-out
even if we reverted ProcLockWakeup to the deadlock-prone behavior.

Possibly we could arrange for ProcLockWakeup to perform a
HandleDeadlock-like algorithm to determine whether there will be a
deadlock if it stops without waking anyone. I don't understand
HandleDeadlock well enough to know what it would take to apply it
to this case.

BTW, where did the HandleDeadlock algorithm come from? It looks to me
like the kind of code that is certainly wrong unless you have a proof
that it's right. I want to see a paper proving that this algorithm
is right ...

regards, tom lane

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Marc G. Fournier 2001-01-13 03:17:05 pgsql/ /HISTORY /README hangeLogs/ChangeLog-7. ...
Previous Message Hiroshi Inoue 2001-01-12 23:59:41 RE: pgsql/src/backend/storage/lmgr (lmgr.c lock.c proc.c README)