Re: [HACKERS] 'Waiting on lock'

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-patches" <pgsql-patches(at)postgresql(dot)org>, "Simon Riggs" <simon(at)2ndquadrant(dot)com>
Subject: Re: [HACKERS] 'Waiting on lock'
Date: 2007-06-20 17:00:16
Message-ID: 87lkeer273.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> Gregory Stark <stark(at)enterprisedb(dot)com> writes:
>> "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
>>> How you figure that?
>
>> Well I'm not clear exactly what's going on with the semaphores here. If it's
>> possible for to be printing the messages only as a result of another backend
>> unlocking the semaphore then making the PGSemaphoreUnlock conditional on
>> log_lock_waits means you can't enable log_lock_waits after startup and get
>> deterministic behaviour because whether you get messages will depend on which
>> other backend happens to wake you up.
>
> I don't see how you arrive at that conclusion. The message is printed
> by the backend that is waiting for (or just obtained) a lock, dependent
> on its own local setting of log_lock_waits, and not dependent on who
> woke it up.

But in your version of the patch you're not calling PGSemaphoreUnlock() unless
log_lock_waits is set in the process doing the waking.

Hm, I suppose it'll wake up itself when its own deadlock timer runs out
anyways. So I guess the worst case is that it doesn't say anything after a
soft deadlock fixup.

> BTW, I just noticed that GUC allows deadlock_timeout to be set all the
> way down to zero. This seems bad --- surely the minimum value should at
> least be positive? As CVS HEAD stands, you're likely to get a lot of
> spurious/useless log messages if you have log_lock_waits = true and
> deadlock_timeout = 0. Do we care?

Does that actually work? I would expect setitimer to turn off the alarm in
that case.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2007-06-20 17:13:54 Re: [HACKERS] 'Waiting on lock'
Previous Message Ireneusz Pluta 2007-06-20 16:36:57 postgresql-icu patch status