Re: Archiver behavior at shutdown

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

Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> What does postmaster do then? Sleep until archiver is done, or exit
> immediately and hope that the archiver goes away as soon as it finishes?

I think it can just exit immediately, particularly if we invent the
variant signal for "archive what you can and then quit".

> If the former, then we open the possibility that postmaster lives far
> too long before system shutdown decides to SIGKILL it. If the latter,
> then a subsequent postmaster start could initiate a second archiver
> process which would cause issues with whatever the first archiver is
> doing.

That's a problem that the archiver itself should fix (perhaps it needs
its own lockfile). Consider kill -9 on the postmaster followed by
starting a fresh postmaster --- you have the same problem, and there's
nothing much the postmaster can do about it.

> I think your proposal to handle SIGTERM could also be used whenever
> postmaster has been asked for shutdown (except smart shutdown,
> perhaps?):

>> 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.

No, because during normal shutdown we'd like the archiver to copy away
*all* available segments, not just one.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message James Mansion 2007-12-27 22:41:37 Re: Sorting Improvements for 8.4
Previous Message Alvaro Herrera 2007-12-27 22:24:20 Re: Archiver behavior at shutdown

Browse pgsql-patches by date

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