Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 05AAC632244 for ; Wed, 15 Apr 2009 14:54:51 -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 12363-01 for ; Wed, 15 Apr 2009 14:54:33 -0300 (ADT) Received: from mx3.hub.org (mx3.hub.org [206.223.169.73]) by mail.postgresql.org (Postfix) with ESMTP id 3E28B634B57 for ; Wed, 15 Apr 2009 14:54:44 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outmail128052.authsmtp.co.uk (outmail128052.authsmtp.co.uk [62.13.128.52]) by mx3.hub.org (Postfix) with ESMTP id 23FFA37B4D9 for ; Wed, 15 Apr 2009 14:54:42 -0300 (ADT) Received: from mail-c189.authsmtp.com (mail-c189.authsmtp.com [62.13.128.71]) by punt8.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id n3FHsXVf012783; Wed, 15 Apr 2009 18:54: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 n3FHsWPk076205; Wed, 15 Apr 2009 18:54:32 +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: <3f0b79eb0904150101pb1c59a3ubb422867e8e6a944@mail.gmail.com> References: <3f0b79eb0903242329j12865d55s348f5c873a956e71@mail.gmail.com> <3f0b79eb0903311901h70520cc8u9c0f1d8f4193923b@mail.gmail.com> <3f0b79eb0904022042g35b8e3cah9432ff764e721a3@mail.gmail.com> <1d4e0c10904071456m735e3f67q123b87243d2f6f2a@mail.gmail.com> <3f0b79eb0904071817u5c32254ei61f7e68e54669d9e@mail.gmail.com> <49DDEE72.6030803@enterprisedb.com> <3f0b79eb0904092047w355e0b3ar527a9285b161ef91@mail.gmail.com> <1239381103.16396.30.camel@ebony.2ndQuadrant> <3f0b79eb0904122252t1f4c5860v919d199f399ccf72@mail.gmail.com> <3f0b79eb0904132241p18084914g792cb8e5ab3eebb3@mail.gmail.com> <3f0b79eb0904150101pb1c59a3ubb422867e8e6a944@mail.gmail.com> Content-Type: text/plain Date: Wed, 15 Apr 2009 18:56:03 +0100 Message-Id: <1239818163.23905.55.camel@ebony.2ndQuadrant> Mime-Version: 1.0 X-Mailer: Evolution 2.12.0 Content-Transfer-Encoding: 7bit X-Server-Quench: 79bb360e-29e6-11de-bc7b-001f29070be2 X-AuthRoute: OCdxZQATClZOTQEd DAteCiNZVAwpPBRK HVkIKg5MJUcNSQVJ NksacRtFaQBbbElD HGQLW11EUVV7XGd/ aAgfZQBDYEtPQQdo U1ZAQE1QEQdtHhxP WB1oKloVF15Gf3hy ZUMsXHhaXwp9fBQv QUhUQHAEbDJmdWEe BBVFJVBTIh5Kfh4T aFl/U3NfNGdJBC9q VzwTFhsSEA9kHWxz Tx5FMUgTTkkGBHY7 XwwDGjNnGkNNXyoE NAAvLFIWDS41 X-Authentic-SMTP: 61633235383639.kestrel.dmpriest.net.uk:1562/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.019 tagged_above=0 required=5 tests=AWL=0.019 X-Spam-Level: X-Archive-Number: 200904/856 X-Sequence-Number: 136959 On Wed, 2009-04-15 at 17:02 +0900, Fujii Masao wrote: > On Tue, Apr 14, 2009 at 2:41 PM, Fujii Masao wrote: > > I'd like to propose another simple idea; pg_standby deletes the > > trigger file *whenever* the nextWALfile is a timeline history file. > > A timeline history file is restored at the end of recovery, so it's > > guaranteed that the trigger file is deleted whether nextWALfile > > exists or not. > > > > A timeline history file is restored also at the beginning of > > recovery, so the accidentally remaining trigger file is deleted > > in early warm-standby as a side-effect of this idea. > > Here is the revised patch as above. > > If you notice something, please feel free to comment. Deleting the trigger file when we request a history file works in most cases, but not in all. We also request a history file when we switch timelines, so code comments need slight modification. If take a base backup, switchover and then try to regen the primary from the base backup we would need to switch timelines, which could be problematic. That is unlikely, so we should at least very clearly document the actual behaviour, as we do in the code comments. I think your wording that smart mode guarantees no data will be lost is a little strong. I'd say "on successful completion all WAL records will be replayed resulting in zero data loss". -- Simon Riggs www.2ndQuadrant.com PostgreSQL Training, Services and Support