• Tom Lane's avatar
    Improve client error messages for immediate-stop situations. · 7e784d1d
    Tom Lane authored
    Up to now, if the DBA issued "pg_ctl stop -m immediate", the message
    sent to clients was the same as for a crash-and-restart situation.
    This is confusing, not least because the message claims that the
    database will soon be up again, something we have no business
    predicting.
    
    Improve things so that we can generate distinct messages for the two
    cases (and also recognize an ad-hoc SIGQUIT, should somebody try that).
    To do that, add a field to pmsignal.c's shared memory data structure
    that the postmaster sets just before broadcasting SIGQUIT to its
    children.  No interlocking seems to be necessary; the intervening
    signal-sending and signal-receipt should sufficiently serialize accesses
    to the field.  Hence, this isn't any riskier than the existing usages
    of pmsignal.c.
    
    We might in future extend this idea to improve other
    postmaster-to-children signal scenarios, although none of them
    currently seem to be as badly overloaded as SIGQUIT.
    
    Discussion: https://postgr.es/m/559291.1608587013@sss.pgh.pa.us
    7e784d1d
pmsignal.c 12.1 KB