Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id DC9DC6345F3 for ; Fri, 10 Apr 2009 13:30:44 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 41228-05 for ; Fri, 10 Apr 2009 13:30:43 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outmail137094.authsmtp.co.uk (outmail137094.authsmtp.co.uk [62.13.137.94]) by mail.postgresql.org (Postfix) with ESMTP id AD66E6341E3 for ; Fri, 10 Apr 2009 13:30:42 -0300 (ADT) Received: from mail-c189.authsmtp.com (mail-c189.authsmtp.com [62.13.128.71]) by punt4.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id n3AGUXRZ092923; Fri, 10 Apr 2009 17:30:33 +0100 (BST) Received: from [192.168.0.4] (85-211-223-92.dyn.gotadsl.co.uk [85.211.223.92]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id n3AGUVbA030286; Fri, 10 Apr 2009 17:30:31 +0100 (BST) Subject: Re: New trigger option of pg_standby From: Simon Riggs To: Fujii Masao Cc: Heikki Linnakangas , Guillaume Smet , Tom Lane , Peter Eisentraut , Kevin Grittner , pgsql-hackers In-Reply-To: <3f0b79eb0904092047w355e0b3ar527a9285b161ef91@mail.gmail.com> References: <3f0b79eb0903242329j12865d55s348f5c873a956e71@mail.gmail.com> <1238064633.16568.420.camel@ebony.2ndQuadrant> <49CCBEE0.1080307@gmx.net> <8365.1238163943@sss.pgh.pa.us> <1238164596.16568.604.camel@ebony.2ndQuadrant> <3f0b79eb0903311901h70520cc8u9c0f1d8f4193923b@mail.gmail.com> <3f0b79eb0904022042g35b8e3cah9432ff764e721a3@mail.gmail.com> <1d4e0c10904071456m735e3f67q123b87243d2f6f2a@mail.gmail.com> <3f0b79eb0904071817u5c32254ei61f7e68e54669d9e@mail.gmail.com> <49DDEE72.6030803@enterprisedb.com> <3f0b79eb0904092047w355e0b3ar527a9285b161ef91@mail.gmail.com> Content-Type: text/plain Date: Fri, 10 Apr 2009 17:31:43 +0100 Message-Id: <1239381103.16396.30.camel@ebony.2ndQuadrant> Mime-Version: 1.0 X-Mailer: Evolution 2.12.0 Content-Transfer-Encoding: 7bit X-Server-Quench: e93b1cb1-25ec-11de-bc7b-001f29070be2 X-AuthRoute: OCdxZQATClZOTQEd DAteCiNZVAwpPBRK HVkIKg5MJUcNSQVJ NksacRtFaQVbbElD HGQLW11EUVp7WmN/ aAgfZQBDYEtPQQdo U1ZAQE1QEQdtHhxP WB1vJXwUJXRGe35y bUAsXHJeWgovfEUv Qx0GFHAEYDIzdWEe BBVFJVBTIh5Kfh4T aFl/U3NfNGdJBC9q VzwTFhsSEA9kHWxz Tx5FMUgTTkkGBHY7 XwwDGjNnGkNNXyoE NAAvLFIWDS41 X-Authentic-SMTP: 61633235383639.kestrel.dmpriest.net.uk:1378/Kp X-Report-SPAM: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-Virus-Status: No virus detected - but ensure you scan with your own anti-virus system. X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200904/565 X-Sequence-Number: 136668 Fujii-san, I like the new patch using the content of the file to determine the mode. Much easier to use at failover time. On Fri, 2009-04-10 at 12:47 +0900, Fujii Masao wrote: > > One problem with this patch is that in smart mode, the trigger file is not > > deleted. That's different from current pg_standby behavior, and makes > > accidental failovers after one failover more likely. > > Yes, it's because pg_standby cannot be sure when the trigger file > can be removed in smart mode. If the trigger file is deleted as soon > as it's found, just like in fast mode, pg_standby may keep waiting > for WAL file again. My understanding of smart mode is fairly simple: if (triggered) { if (smartMode && nextWALfile+1 exists) exit(0); else { delete trigger file exit(1); } } If you perform a file lookahead (the +1) as shown above then you avoid the problem Heikki observes. -- Simon Riggs www.2ndQuadrant.com PostgreSQL Training, Services and Support