Re: [PATCHES] Fix "database is ready" race condition - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCHES] Fix "database is ready" race condition
Date
Msg-id 22185.1170616518@sss.pgh.pa.us
Whole thread Raw
Responses Re: [PATCHES] Fix "database is ready" race condition  (Markus Schiltknecht <markus@bluegap.ch>)
Re: [PATCHES] Fix "database is ready" race condition  ("Simon Riggs" <simon@2ndquadrant.com>)
List pgsql-hackers
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 don't think there's any compelling reason for having that log message
in its current form.  What about redefining it to mean "postmaster is
ready to accept connections" --- either with that wording, or keeping
the old wording?  Then we could just put it in one place in postmaster.c
and be done.  I think your proposed patch is overcomplicated by trying
to have it still come out in bootstrap/standalone cases.  For a
standalone backend, getting a prompt is what tells you it's ready ;-)
        regards, tom lane


pgsql-hackers by date:

Previous
From: Theo Schlossnagle
Date:
Subject: Re: Proposal: Commit timestamp
Next
From: Andrew Dunstan
Date:
Subject: Re: \copy (query) delimiter syntax error