Re: Archiver behavior at shutdown

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Archiver behavior at shutdown
Date: 2007-12-27 21:57:00
Message-ID: 21004.1198792620@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Simon Riggs <simon(at)2ndquadrant(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2007-12-27 22:13:57 Re: Spoofing as the postmaster
Previous Message Magnus Hagander 2007-12-27 21:50:22 Re: Spoofing as the postmaster

Browse pgsql-patches by date

  From Date Subject
Next Message Alvaro Herrera 2007-12-27 22:24:20 Re: Archiver behavior at shutdown
Previous Message Simon Riggs 2007-12-27 21:29:11 Re: Archiver behavior at shutdown