Re: Advisory locks seem rather broken

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org, Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>
Subject: Re: Advisory locks seem rather broken
Date: 2012-05-04 13:17:28
Message-ID: CA+TgmoZwNupiyGLjA6HFp-QWqaM8Cx4-5r6YJjU961Erg895mA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, May 3, 2012 at 5:18 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> ... btw, it appears to me that the "fast path" patch has broken things
> rather badly in LockReleaseAll.  AFAICS it's not honoring either the
> lockmethodid restriction nor the allLocks restriction with respect to
> fastpath locks.  Perhaps user locks and session locks are never taken
> fast path, but still it would be better to be making those checks
> further up, no?

User locks are never taken fast path, but session locks can be, so I
think you're right that there is a bug here. I think what we should
probably do is put the nLocks == 0 test before the lockmethodid and
allLocks checks, and then the fast path stuff after those two checks.

In 9.1, we just did this:

if (locallock->proclock == NULL || locallock->lock == NULL)
{
/*
* We must've run out of shared memory while
trying to set up this
* lock. Just forget the local entry.
*/
Assert(locallock->nLocks == 0);
RemoveLocalLock(locallock);
continue;
}

...and I just shoved the new logic into that stanza without thinking
hard enough about what order to do things in.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-05-04 13:25:37 Re: Advisory locks seem rather broken
Previous Message Simon Riggs 2012-05-04 13:16:22 Re: Future In-Core Replication