Re: Stefan's bug (was: max_standby_delay considered harmful)

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Florian Pflug <fgp(at)phlo(dot)org>, Dimitri Fontaine <dfontaine(at)hi-media(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Bruce Momjian <bruce(at)momjian(dot)us>, Greg Smith <greg(at)2ndquadrant(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>
Subject: Re: Stefan's bug (was: max_standby_delay considered harmful)
Date: 2010-05-18 02:40:20
Message-ID: AANLkTikWt21uZelewDV4CMFUiE-a-BnsNdKPYEsFjhIZ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, May 17, 2010 at 10:20 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> OK, I think I understand now.  But, the SIGTERM sent by the postmaster
> doesn't kill the recovery process unconditionally.  It will invoke
> StartupProcShutdownHandler(), which will set set shutdown_requested =
> true.  That gets checked by RestoreArchivedFile() and
> HandleStartupProcInterrupts(), and I think that neither of those can
> get invoked until after the control file has been updated.  Do you see
> a way it can happen?

Yeah, the way is:
StartupXLOG() --> ReadCheckpointRecord() --> ReadRecord() -->
XLogPageRead() --> XLogFileReadAnyTLI() --> XLogFileRead() -->
RestoreArchivedFile()

ReadCheckpointRecord() is called before pg_control is updated.

ISTM that walreceiver might be invoked even after shutdown is requested.
We should prevent the postmaster from starting up walreceiver if
Shutdown > NoShutdown?

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2010-05-18 03:02:27 Re: Stefan's bug (was: max_standby_delay considered harmful)
Previous Message Robert Haas 2010-05-18 01:37:27 Re: Performance problem in textanycat/anytextcat