Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id C8274633A4B for ; Tue, 12 May 2009 08:15:18 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 50895-10 for ; Tue, 12 May 2009 08:15:16 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from exprod7og109.obsmtp.com (exprod7og109.obsmtp.com [64.18.2.171]) by mail.postgresql.org (Postfix) with SMTP id 498EB633A7C for ; Tue, 12 May 2009 08:15:14 -0300 (ADT) Received: from source ([74.125.78.149]) by exprod7ob109.postini.com ([64.18.6.12]) with SMTP ID DSNKSglaQGKOUJ6ArJ5Y3WP2QFY8IHv2mtAN@postini.com; Tue, 12 May 2009 04:15:16 PDT Received: by ey-out-1920.google.com with SMTP id 13so812026eye.24 for ; Tue, 12 May 2009 04:15:11 -0700 (PDT) Received: by 10.210.60.8 with SMTP id i8mr1442574eba.54.1242126911596; Tue, 12 May 2009 04:15:11 -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 10sm9649543eyz.21.2009.05.12.04.15.06 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 12 May 2009 04:15:07 -0700 (PDT) Message-ID: <4A095A39.3030100@enterprisedb.com> Date: Tue, 12 May 2009 14:15:05 +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 , Guillaume Smet , Tom Lane , Peter Eisentraut , Kevin Grittner , pgsql-hackers Subject: Re: New trigger option of pg_standby References: <3f0b79eb0903242329j12865d55s348f5c873a956e71@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> <49EE1E3F.9050307@enterprisedb.com> <3f0b79eb0904212209i7fbd8b68k71db1fef09c62751@mail.gmail.com> <49F01D79.8020805@enterprisedb.com> <3f0b79eb0904230515p751b5248n6ef96880617db055@mail.gmail.com> In-Reply-To: <3f0b79eb0904230515p751b5248n6ef96880617db055@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/537 X-Sequence-Number: 138079 Fujii Masao wrote: > On Thu, Apr 23, 2009 at 4:49 PM, Heikki Linnakangas > wrote: >> This is getting complicated, though. I guess it would be enough to document >> that you mustn't copy any extra files into pg_xlog if you use a fast >> trigger. > > Agreed. I added this note into document. > > Attached is the updated patch. I also fixed my bug which > pg_standby returns 0 even if the requested file fails to be > restored in smart mode. > > This patch is ready to commit, I think. Please review this. Looking at this again.. Deleting the trigger file when a history file is requested: > /* > * Get rid of the trigger file at the end of archive recovery. > * Otherwise, it would unexpectedly cause the subsequent warm-standby to > * end. > * > * Here is the right place to remove the trigger file since a timeline > * history file is requested only at the beginning and end of archive > * recovery. > */ changes the behavior in a subtle way: if you create trigger file before starting recovery, it will be deleted when the recovery is started and no failover is done. Currently, it will end the recovery immediately. That makes me uncomfortable to back-patch this. That change in behavior might be hard to work-around: the process that creates the trigger file would have to make sure that the server has started recovery before creating the file. Here's another idea: Let's modify xlog.c so that when the server asks for WAL file X, and restore_command returns "not found", the server will not ask for any WAL files >= X again (in that recovery session). Presumably if X doesn't exist, no later files will exist either. That would be pretty simple change, and it would allow us to go with the simpler implementation in pg_standby and just remove the trigger file immediately when it returns "not found" (instead of removing it when history file is requested). That would make it safe to copy extra WAL files into pg_xlog, even in fast failover mode. Does anyone see a hole in that idea? -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com