Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 53EE36326D9 for ; Tue, 21 Apr 2009 09:55:20 -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 57974-03 for ; Tue, 21 Apr 2009 09:55:08 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from exprod7og102.obsmtp.com (exprod7og102.obsmtp.com [64.18.2.157]) by mail.postgresql.org (Postfix) with SMTP id DD91B62FBB4 for ; Tue, 21 Apr 2009 09:55:15 -0300 (ADT) Received: from source ([74.125.78.147]) by exprod7ob102.postini.com ([64.18.6.12]) with SMTP ID DSNKSe3CMWK9rAaKLleb+KXYvgJT4HVZ6APP@postini.com; Tue, 21 Apr 2009 05:55:15 PDT Received: by ey-out-1920.google.com with SMTP id 3so206317eyh.42 for ; Tue, 21 Apr 2009 05:55:13 -0700 (PDT) Received: by 10.210.38.5 with SMTP id l5mr7006858ebl.93.1240318513199; Tue, 21 Apr 2009 05:55:13 -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 7sm3675484eyg.4.2009.04.21.05.55.11 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 21 Apr 2009 05:55:12 -0700 (PDT) Message-ID: <49EDC22E.9030506@enterprisedb.com> Date: Tue, 21 Apr 2009 15:55:10 +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> <3f0b79eb0904132241p18084914g792cb8e5ab3eebb3@mail.gmail.com> <3f0b79eb0904150101pb1c59a3ubb422867e8e6a944@mail.gmail.com> <49EC3B01.6050509@enterprisedb.com> <3f0b79eb0904200354u41b54017u16dc73d021c03cdb@mail.gmail.com> <49EC8B06.3020204@enterprisedb.com> <1240311836.23905.206.camel@ebony.fara.com> <49EDAB5B.5040400@enterprisedb.com> <1240313150.23905.222.camel@ebony.fara.com> <49EDADD6.1090006@enterprisedb.com> <3f0b79eb0904210448l36d9bb27u8b832540010a6f20@mail.gmail.com> In-Reply-To: <3f0b79eb0904210448l36d9bb27u8b832540010a6f20@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: 200904/1075 X-Sequence-Number: 137178 Fujii Masao wrote: > On Tue, Apr 21, 2009 at 8:28 PM, Heikki Linnakangas > wrote: >> Simon Riggs wrote: >>> What you propose is *better* than raw pg_standby is now, but still not >>> enough in all cases, as I think you know. >> No, I don't. What is the case where it doesn't work? > > It's the case which I described as the 2nd comment to your > proposal. > > 1. pg_standby tries to restore a non-existent file > 1-1. remove the trigger file > 1-2. pg_standby exits with non-zero code > 2. the startup process tries to read it from pg_xlog > 2-1. it is applied > 3. the startup process tries to restore the next file using pg_standby > 3-1. pg_standby gets *stuck* since the requested file and trigger file > don't exist. Ahh, ok, I didn't understand the issue correctly before. But wait a minute, we already have exactly the same problem with the current 8.2/8.3 pg_standby, don't we? [tests]. Yes, we do. Simon's suggestion of a separate restore_completion_command is very attractive as it would provide an explicit place to hook up the deletion of the trigger file. It seems useful anyway, you might want to put a command there to e.g update a log file or launch some custom daemon software when the recovery ends. The question then is what to do with 8.2 and 8.3? Even if we decided to keep the behavior that the failover is triggered immediately (fast mode), pg_standby getting stuck if you copy any WAL files directly into pg_xlog seems like a bug that needs to be fixed. Fujii's idea of deleting the trigger file when history file is requested is the only proposal this far that works and doesn't require changes to people's config files, so I guess that's what we'll have to do at least for back-branches. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com