Re: Archiver behavior at shutdown - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Archiver behavior at shutdown
Date
Msg-id 21004.1198792620@sss.pgh.pa.us
Whole thread Raw
In response to Re: Archiver behavior at shutdown  (Simon Riggs <simon@2ndquadrant.com>)
List pgsql-hackers
Simon Riggs <simon@2ndquadrant.com> writes:
> ...based upon limitations of the existing system. We have been
> SIGQUIT'ing the archiver, and there is a comment there to say how
> important it is that we *do not* try to finish processing before we
> quit. If you think that comment is wrong, thats OK by me: I can't recall
> the reasoning there, or even if it was my own.

That comment is clearly wrong --- it applies to the SIGTERM situation.

>> Another case that needs some revisiting is the archiver's response
>> to SIGTERM, which is currently SIG_IGN.  Since the postmaster will never
>> send it SIGTERM, we should assume that receipt of SIGTERM means that
>> init is telling us we have N seconds left before system shutdown.
>> Is it a good idea to continue archiving in that situation?  I doubt it
>> --- it seems like we are just asking to get SIGKILL'd partway through a
>> copy step.  I suggest that the response to SIGTERM ought to be to finish
>> out the current copy operation (if possible) but then quit without
>> initiating any new ones.

> Not sure about that. If there are outstanding files to archive, then it
> probably is important to try to archive them. Mostly this won't be the
> case, but if this was, for example a simple switchover between a primary
> and a warm standby then it might result in data loss.

A simple switchover ought to be done by bringing down the postmaster,
not the whole machine.

The real question here is whether it's sane to try to do archiving on a
machine that is in the midst of shutdown.  As an example, it's quite
likely that NFS mounts are going to go away sometime between SIGTERM and
SIGKILL, if they haven't done so already.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: Spoofing as the postmaster
Next
From: Stephen Frost
Date:
Subject: Re: Spoofing as the postmaster