Re: Stefan's bug (was: max_standby_delay considered harmful)
Fujii Masao <masao.fujii@gmail.com>
From: Fujii Masao <masao.fujii@gmail.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>, Stefan Kaltenbrunner <stefan@kaltenbrunner.cc>, Simon Riggs <simon@2ndquadrant.com>, Andres Freund <andres@anarazel.de>, Florian Pflug <fgp@phlo.org>, Dimitri Fontaine <dfontaine@hi-media.com>, Tom Lane <tgl@sss.pgh.pa.us>, pgsql-hackers <pgsql-hackers@postgresql.org>, Bruce Momjian <bruce@momjian.us>, Greg Smith <greg@2ndquadrant.com>, Josh Berkus <josh@agliodbs.com>
Date: 2010-05-18T02:40:20Z
Lists: pgsql-hackers
On Mon, May 17, 2010 at 10:20 PM, Robert Haas <robertmhaas@gmail.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