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 10:32:46
Message-ID: 4FF41BCE.2030503@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2012-07-04 12:09 keltezéssel, Boszormenyi Zoltan írta:
> 2012-07-03 23:31 keltezéssel, Alvaro Herrera írta:
>> Excerpts from Boszormenyi Zoltan's message of vie jun 29 14:30:28 -0400 2012:
>>
>>> Does anyone have a little time to look at the latest timeout framework
>>> with the registration interface and the 2nd patch too? I am at work
>>> until Friday next week, after that I will be on vacation for two weeks.
>>> Just in case there is anything that needs tweaking to make it more
>>> acceptable.
>> I cleaned up this a bit more and now I think it's ready to commit --
>> as soon as somebody tests that the standby bits still work.
>
> You just broke initdb with this cleanup. :-)
>
> ---8<------8<------8<------8<------8<------8<------8<---
> $ cat src/test/regress/log/initdb.log
> Running in noclean mode. Mistakes will not be cleaned up.
> The files belonging to this database system will be owned by user "zozo".
> This user must also own the server process.
>
> The database cluster will be initialized with locales
> COLLATE: hu_HU.utf8
> CTYPE: hu_HU.utf8
> MESSAGES: C
> MONETARY: hu_HU.utf8
> NUMERIC: hu_HU.utf8
> TIME: hu_HU.utf8
> The default database encoding has accordingly been set to "UTF8".
> The default text search configuration will be set to "hungarian".
>
> creating directory
> /home/zozo/lock-timeout/9.1/1/postgresql.14/src/test/regress/./tmp_check/data ... ok
> creating subdirectories ... ok
> selecting default max_connections ... 100
> selecting default shared_buffers ... 32MB
> creating configuration files ... ok
> creating template1 database in
> /home/zozo/lock-timeout/9.1/1/postgresql.14/src/test/regress/./tmp_check/data/base/1 ... ok
> initializing pg_authid ... TRAP: FailedAssertion("!(base_timeouts_initialized)", File:
> "timeout.c", Line: 217)
> sh: line 1: 29872 Aborted (core dumped)
> "/home/zozo/lock-timeout/9.1/1/postgresql.14/src/test/regress/tmp_check/install/home/zozo/pgc92dev-locktimeout/bin/postgres"
> --single -F -O -c search_path=pg_catalog -c exit_on_error=true template1 > /dev/null
> child process exited with exit code 134
> initdb: data directory
> "/home/zozo/lock-timeout/9.1/1/postgresql.14/src/test/regress/./tmp_check/data" not
> removed at user's request
> ---8<------8<------8<------8<------8<------8<------8<---
>
> 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().

Comments?

Best regards,
Zoltán Böszörményi

--
----------------------------------
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-v14-fix.patch text/x-patch 3.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Boszormenyi Zoltan 2012-07-04 11:03:44 Re: [PATCH] lock_timeout and common SIGALRM framework
Previous Message Boszormenyi Zoltan 2012-07-04 10:09:37 Re: [PATCH] lock_timeout and common SIGALRM framework