Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 22E90632209 for ; Tue, 14 Apr 2009 06:05:43 -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 66803-08 for ; Tue, 14 Apr 2009 06:05:38 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.25]) by mail.postgresql.org (Postfix) with ESMTP id 3F3796321C5 for ; Tue, 14 Apr 2009 06:05:37 -0300 (ADT) Received: by qw-out-2122.google.com with SMTP id 8so2475593qwh.61 for ; Tue, 14 Apr 2009 02:05:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=Nnel/vlYkZHPl45fRGgYL3+cnKtwiWm0X3Zv/EDchjM=; b=rQX1e78dTOpKL2/7PJGmzK6QFq0QpUAFrwV4H3uN3dPvMVe0qkttTbOCT7rH3pr/Bs KQI9vIP35N7OWRoMlYFY1Nys0OTW+nU6QkymbyW+fA0gpcFBKk4tD96nedguzVaByiaC RDJLhrZUUmRnjzDpL24UwzAfDiFvK7zfFoedU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=Bh6HB9Ox4RdCnLDnWTE3DCODjUULgKOBBhEfnXRz2FP7l7XxyRaSrCej6d/DVVDlv0 toio/8rOnRI0ZCSPmxzD3XUomh/pRx7ti14P1K+QrmrxrDWZEkDldPmTM9dbuFAeSWrr iyrMV9hWjkPTK6215IRSK/edCaScHV01cymVA= MIME-Version: 1.0 Received: by 10.220.74.71 with SMTP id t7mr7361919vcj.97.1239687710806; Mon, 13 Apr 2009 22:41:50 -0700 (PDT) In-Reply-To: <3f0b79eb0904122252t1f4c5860v919d199f399ccf72@mail.gmail.com> References: <3f0b79eb0903242329j12865d55s348f5c873a956e71@mail.gmail.com> <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> <1239381103.16396.30.camel@ebony.2ndQuadrant> <3f0b79eb0904122252t1f4c5860v919d199f399ccf72@mail.gmail.com> Date: Tue, 14 Apr 2009 14:41:50 +0900 Message-ID: <3f0b79eb0904132241p18084914g792cb8e5ab3eebb3@mail.gmail.com> Subject: Re: New trigger option of pg_standby From: Fujii Masao To: Simon Riggs Cc: Heikki Linnakangas , Guillaume Smet , Tom Lane , Peter Eisentraut , Kevin Grittner , pgsql-hackers Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.394 tagged_above=0 required=5 tests=DATE_IN_PAST_03_06=1.394 X-Spam-Level: * X-Archive-Number: 200904/742 X-Sequence-Number: 136845 Hi, On Mon, Apr 13, 2009 at 2:52 PM, Fujii Masao wrote: > But, a lookahead nextWALfile seems to work fine. > > if (triggered) > { > =A0 =A0if (smartMode && nextWALfile exists) > =A0 =A0 =A0 =A0exit(0) > =A0 =A0else > =A0 =A0{ > =A0 =A0 =A0 =A0delete trigger file > =A0 =A0 =A0 =A0exit(1) > =A0 =A0} > } Umm... in this algorithm, the trigger file remains after failover if the nextWALfile has the invalid record which means the end of WAL files. 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. How does that sound? Regards, --=20 Fujii Masao NIPPON TELEGRAPH AND TELEPHONE CORPORATION NTT Open Source Software Center