• Tom Lane's avatar
    Shift the responsibility for emitting "database system is shut down". · d18643c4
    Tom Lane authored
    Historically this message has been emitted at the end of ShutdownXLOG().
    That's not an insane place for it in a standalone backend, but in the
    postmaster environment we've grown a fair amount of stuff that happens
    later, including archiver/walsender shutdown, stats collector shutdown,
    etc.  Recent buildfarm experimentation showed that on slower machines
    there could be many seconds' delay between finishing ShutdownXLOG() and
    actual postmaster exit.  That's fairly confusing, both for testing
    purposes and for DBAs.  Hence, move the code that prints this message
    into UnlinkLockFiles(), so that it comes out just after we remove the
    postmaster's pidfile.  That is a more appropriate definition of "is shut
    down" from the point of view of "pg_ctl stop", for example.  In general,
    removing the pidfile should be the last externally-visible action of
    either a postmaster or a standalone backend; compare commit
    d73d14c2 for instance.  So this seems
    like a reasonably future-proof approach.
    d18643c4
xlog.c 358 KB