Re: [PATCH] lock_timeout and common SIGALRM framework

Boszormenyi Zoltan <zb@cybertec.at>

From: Boszormenyi Zoltan <zb@cybertec.at>
To: Alvaro Herrera <alvherre@commandprompt.com>
Cc: Marc Cousin <cousinmarc@gmail.com>, Pg Hackers <pgsql-hackers@postgresql.org>, Hans-Juergen Schoenig <hs@cybertec.at>, Ants Aasma <ants@cybertec.at>, Robert Haas <robertmhaas@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>
Date: 2012-07-04T10:32:46Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix Windows implementation of PGSemaphoreLock.

Attachments

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/