Re: [PATCH] lock_timeout and common SIGALRM framework

From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Marc Cousin <cousinmarc(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Hans-Juergen Schoenig <hs(at)cybertec(dot)at>, Ants Aasma <ants(at)cybertec(dot)at>, Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: [PATCH] lock_timeout and common SIGALRM framework
Date: 2012-07-04 18:36:08
Message-ID: 4FF48D18.5020700@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2012-07-04 17:20 keltezéssel, Alvaro Herrera írta:
> Excerpts from Boszormenyi Zoltan's message of mié jul 04 06:32:46 -0400 2012:
>> 2012-07-04 12:09 keltezéssel, Boszormenyi Zoltan írta:
>>> You just broke initdb with this cleanup. :-)
> Ouch.
>
>>> initdb starts postgres --single, that doesn't do BackendInitialize(),
>>> only PostgresMain(). So, you need InitializeTimeouts() before
>>> the RegisterTimeout() calls in PostgresMain and the elog(PANIC)
>>> must not be in InitializeTimeouts() if called twice.
>> Attached is the fix for this problem. PostgresMain() has a new
>> argument: bool single_user. This way, InitializeTimeouts() can
>> keep its elog(PANIC) if called twice and "postgres --single"
>> doesn't fail its Assert() in RegisterTimeout().
> Hmm. Maybe it's better to leave InitializeTimeouts to be called twice
> after all. The fix seems a lot uglier than the disease it's curing.

Attached are the refreshed patches. InitializeTimeouts() can be called
twice and PGSemaphoreTimedLock() returns bool now. This saves
two calls to get_timeout_indicator().

--
----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt, Austria
Web: http://www.postgresql-support.de
http://www.postgresql.at/

Attachment Content-Type Size
1-timeout-framework-v15.patch text/x-patch 39.1 KB
2-lock_timeout-v15.patch text/x-patch 38.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-07-04 19:41:42 Re: WIP patch for Todo Item : Provide fallback_application_name in contrib/pgbench, oid2name, and dblink
Previous Message Pavel Stehule 2012-07-04 18:10:14 Re: enhanced error fields