Re: Fix "database is ready" race condition - Mailing list pgsql-patches

From Tom Lane
Subject Re: Fix "database is ready" race condition
Date
Msg-id 14117.1170866785@sss.pgh.pa.us
Whole thread Raw
In response to Fix "database is ready" race condition  (Markus Schiltknecht <markus@bluegap.ch>)
Responses Re: Fix "database is ready" race condition
List pgsql-patches
Markus Schiltknecht <markus@bluegap.ch> writes:
> is there a good reason to print the "database system is ready" message
> in StartupXLOG() in xact.c? It has a) nothing to do with xlog and b)
> opens a small race condition: the message gets printed, while it still
> take some CPU cycles until the postmaster really gets the SIGCHLD signal
> and sets StartupPID = 0. If you (or rather: an automated test program)
> try to connect within this timespan, you get a "database is starting up"
> error, which clearly contradicts the "is ready" message.

I've applied a modified form of this patch.  The postmaster now says
"database system is ready to accept connections" after it's finished
reacting to the completion of the startup process.

            regards, tom lane

pgsql-patches by date:

Previous
From: Gregory Stark
Date:
Subject: Re: LIMIT/SORT optimization
Next
From: Markus Schiltknecht
Date:
Subject: Re: Fix "database is ready" race condition