• Tom Lane's avatar
    Minor adjustments to make failures in startup/shutdown behave more cleanly. · 5f60086e
    Tom Lane authored
    StartupXLOG and ShutdownXLOG no longer need to be critical sections, because
    in all contexts where they are invoked, elog(ERROR) would be translated to
    elog(FATAL) anyway.  (One change in bgwriter.c is needed to make this true:
    set ExitOnAnyError before trying to exit.  This is a good fix anyway since
    the existing code would have gone into an infinite loop on elog(ERROR) during
    shutdown.)  That avoids a misleading report of PANIC during semi-orderly
    failures.  Modify the postmaster to include the startup process in the set of
    processes that get SIGTERM when a fast shutdown is requested, and also fix it
    to not try to restart the bgwriter if the bgwriter fails while trying to write
    the shutdown checkpoint.  Net result is that "pg_ctl stop -m fast" does
    something reasonable for a system in warm standby mode, and so should Unix
    system shutdown (ie, universal SIGTERM).  Per gripe from Stephen Harris and
    some corner-case testing of my own.
    5f60086e
postmaster.c 108 KB