Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 7A2686327B4 for ; Wed, 13 May 2009 05:46:00 -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 81976-01 for ; Wed, 13 May 2009 05:45:59 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from exprod7og106.obsmtp.com (exprod7og106.obsmtp.com [64.18.2.165]) by mail.postgresql.org (Postfix) with SMTP id 71F636324E2 for ; Wed, 13 May 2009 05:45:58 -0300 (ADT) Received: from source ([209.85.219.157]) by exprod7ob106.postini.com ([64.18.6.12]) with SMTP ID DSNKSgqIxOiyq03FB3GfokERKc0hT7uqDiPg@postini.com; Wed, 13 May 2009 01:45:58 PDT Received: by ewy1 with SMTP id 1so606472ewy.26 for ; Wed, 13 May 2009 01:45:55 -0700 (PDT) Received: by 10.210.134.6 with SMTP id h6mr2605164ebd.0.1242203861458; Wed, 13 May 2009 01:37:41 -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 23sm2085552eya.39.2009.05.13.01.37.40 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 13 May 2009 01:37:40 -0700 (PDT) Message-ID: <4A0A86D2.9080602@enterprisedb.com> Date: Wed, 13 May 2009 11:37:38 +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> <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> <4A095A39.3030100@enterprisedb.com> <3f0b79eb0905130127u3a3275b1w79f4d8cb729ded36@mail.gmail.com> In-Reply-To: <3f0b79eb0905130127u3a3275b1w79f4d8cb729ded36@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/562 X-Sequence-Number: 138104 Fujii Masao wrote: > On Tue, May 12, 2009 at 8:15 PM, Heikki Linnakangas > wrote: >> 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? > > Probably yes. The trigger file would remain after failover if the > restored WAL file has the invalid record which means the end > of WAL. In this case, "not found" is not returned. Yep. That's not pleasant either :-(. I don't think we're going to get this to work reliably without extending the interface between the backend and restore_command. We've discussed many methods and there's always some nasty corner-case like that. I think we should leave back-branches as is, and go with Simon's suggestion to add new "recovery_end_command" that's run when the recovery is finished. That's simpler and more reliable than any of the other approaches we've discussed, and might become handy for other purposes as well. Does someone want to take a stab at writing a patch for that? -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com