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