Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 44DBF633DB7 for ; Thu, 14 May 2009 17:31:28 -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 80165-10 for ; Thu, 14 May 2009 17:31:20 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from exprod7og112.obsmtp.com (exprod7og112.obsmtp.com [64.18.2.177]) by mail.postgresql.org (Postfix) with SMTP id 2460B633D2D for ; Thu, 14 May 2009 17:31:23 -0300 (ADT) Received: from source ([209.85.219.161]) by exprod7ob112.postini.com ([64.18.6.12]) with SMTP ID DSNKSgx/mhCCFTCcdbIjF+92tBfeR/WJTmTE@postini.com; Thu, 14 May 2009 13:31:24 PDT Received: by ewy5 with SMTP id 5so2564081ewy.30 for ; Thu, 14 May 2009 13:31:21 -0700 (PDT) Received: by 10.210.86.10 with SMTP id j10mr10403679ebb.70.1242333081051; Thu, 14 May 2009 13:31:21 -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 24sm616702eyx.3.2009.05.14.13.31.19 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 14 May 2009 13:31:19 -0700 (PDT) Message-ID: <4A0C7F96.2040407@enterprisedb.com> Date: Thu, 14 May 2009 23:31:18 +0300 From: Heikki Linnakangas Organization: EnterpriseDB User-Agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103) MIME-Version: 1.0 To: Simon Riggs CC: Fujii Masao , 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> <1242328204.3843.599.camel@ebony.2ndQuadrant> In-Reply-To: <1242328204.3843.599.camel@ebony.2ndQuadrant> 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/629 X-Sequence-Number: 138171 I've finally committed Simon's recovery_end_command patch, as well as the changes to pg_standby. There's now smart and fast failover modes, chosen by the content of the trigger file, smart mode is the default. A "fast" trigger file is truncated, turning it into a "smart" trigger for subsequent pg_standby invocations. I believe this is now safe in all the combinations discussed, in both fast and smart mode, with or without extra WAL files copied to pg_xlog, and also if the last archived WAL file is incomplete. You now need to set up recovery_end_command to clean up the trigger file; pg_standby no longer does that automatically. Simon Riggs wrote: > On Fri, 2009-05-15 at 03:49 +0900, Fujii Masao wrote: >> Hi, >> >> 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 >> >> 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? > > Using rm -f would avoid the WARNING. > > I'd rather keep it at WARNING, since not sure what command I'll be > running and what a non-zero rc means. > -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com