Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 320C86325F7 for ; Thu, 14 May 2009 16:05:30 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 62079-08 for ; Thu, 14 May 2009 16:05:24 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from exprod7og119.obsmtp.com (exprod7og119.obsmtp.com [64.18.2.16]) by mail.postgresql.org (Postfix) with SMTP id A7FCF63231E for ; Thu, 14 May 2009 16:05:26 -0300 (ADT) Received: from source ([209.85.219.166]) by exprod7ob119.postini.com ([64.18.6.12]) with SMTP ID DSNKSgxrdQaNcl+OmssJeiZqu+izsMAdzLfd@postini.com; Thu, 14 May 2009 12:05:26 PDT Received: by mail-ew0-f166.google.com with SMTP id 10so1862364ewy.23 for ; Thu, 14 May 2009 12:05:24 -0700 (PDT) Received: by 10.210.86.10 with SMTP id j10mr3156811ebb.1.1242327924857; Thu, 14 May 2009 12:05:24 -0700 (PDT) Received: from ?80.223.212.7? (dsl-hkibrasgw2-fed4df00-7.dhcp.inet.fi [80.223.212.7]) by mx.google.com with ESMTPS id 28sm482441eyg.44.2009.05.14.12.05.23 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 14 May 2009 12:05:24 -0700 (PDT) Message-ID: <4A0C6B71.4050003@enterprisedb.com> Date: Thu, 14 May 2009 22:05:21 +0300 From: Heikki Linnakangas Organization: EnterpriseDB User-Agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103) MIME-Version: 1.0 To: Fujii Masao CC: Simon Riggs , Tom Lane , Guillaume Smet , Peter Eisentraut , Kevin Grittner , pgsql-hackers Subject: Re: New trigger option of pg_standby References: <3f0b79eb0903242329j12865d55s348f5c873a956e71@mail.gmail.com> <49F01D79.8020805@enterprisedb.com> <3f0b79eb0904230515p751b5248n6ef96880617db055@mail.gmail.com> <4A095A39.3030100@enterprisedb.com> <3f0b79eb0905130127u3a3275b1w79f4d8cb729ded36@mail.gmail.com> <4A0A86D2.9080602@enterprisedb.com> <1985.1242234105@sss.pgh.pa.us> <4A0B10C7.2040309@enterprisedb.com> <1242247404.3843.503.camel@ebony.2ndQuadrant> <1242315415.3843.526.camel@ebony.2ndQuadrant> <3f0b79eb0905141149lf5cef92j538f490c86dfedf8@mail.gmail.com> In-Reply-To: <3f0b79eb0905141149lf5cef92j538f490c86dfedf8@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200905/624 X-Sequence-Number: 138166 Fujii Masao wrote: > On Fri, May 15, 2009 at 12:36 AM, Simon Riggs wrote: >> On Wed, 2009-05-13 at 21:43 +0100, Simon Riggs wrote: >>> On Wed, 2009-05-13 at 21:26 +0300, Heikki Linnakangas wrote: >>> >>>> This whole thing can be considered to be a new feature. >>> recovery.conf will contain a new optional parameter: >>> >>> recovery_end_command (string) >> Implemented. > >> + ereport(signaled ? FATAL : WARNING, >> + (errmsg("recovery_end_command \"%s\": return code %d", >> + xlogRecoveryEndCmd, rc))); > > In fast failover case, pg_standby has to delete the trigger file immediately > if it's found. Otherwise, recovery may go wrong as I already described. > http://archives.postgresql.org/pgsql-hackers/2009-04/msg01139.php And if you delete it immediately, you risk getting stuck if there's extra WAL files in pg_xlog. So still need the change in the backend to not call restore_command again for a WAL segment equal to or later than one that it already failed to restore. Or, we can truncate the trigger file to make it behave like a smart failover for the subsequent pg_standby calls. > So, in fast mode, recovery_end_command would always fail to delete the > trigger file, and cause warning. This is odd behavior, I think. We should > change WARNING to DEBUG2 like RestoreArchivedFile() in the above code? I think we should just change the pg_standby example to use "rm -f" rather than "rm". It seems useful to give a warning if the command fails. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com