Re: Interruptible sleeps (was Re: CommitFest 2009-07: Yay, Kevin! Thanks, reviewers!)

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: Interruptible sleeps (was Re: CommitFest 2009-07: Yay, Kevin! Thanks, reviewers!)
Date: 2010-09-13 06:10:29
Message-ID: 4C8DC055.7040900@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 12/09/10 20:13, Jeff Davis wrote:
> On Sun, 2010-09-12 at 12:29 -0400, Tom Lane wrote:
>>> ... why throw an ERROR there if it can't happen (or
>>> indicates an inconsistent state when it does happen)?
>>
>> Are you suggesting that an Assert would be sufficient?
>
> I'm not too picky about whether it's Assert, ERROR, or PANIC (Asserts
> aren't available in production systems, which I assume is why elog was
> used);

Right, OwnLatch is a not performance-critical, so it's better to elog()
IMHO.

> but we should be consistent and document that:
> (a) it shouldn't happen
> (b) that it's just a sanity check and we're ignoring the race

Would this be sufficient?

--- a/src/backend/port/unix_latch.c
+++ b/src/backend/port/unix_latch.c
@@ -156,6 +156,7 @@ OwnLatch(volatile Latch *latch)
if (selfpipe_readfd == -1)
initSelfPipe();

+ /* sanity check */
if (latch->owner_pid != 0)
elog(ERROR, "latch already owned");
latch->owner_pid = MyProcPid;

Or you want to suggest something better?

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Haggerty 2010-09-13 07:32:15 Re: cvs2git reports a "sprout" from a nonexistent commit?
Previous Message Heikki Linnakangas 2010-09-13 06:03:32 Re: Walsender doesn't process options passed in the startup packet