Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TCMUj-0001dc-Iq for pgsql-bugs@postgresql.org; Fri, 14 Sep 2012 03:23:05 +0000 Received: from szxga01-in.huawei.com ([119.145.14.64]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TCMUh-0001oE-Fp for pgsql-bugs@postgresql.org; Fri, 14 Sep 2012 03:23:05 +0000 Received: from 172.24.2.119 (EHLO szxeml211-edg.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.4-GA FastPath queued) with ESMTP id AOX39515; Fri, 14 Sep 2012 11:22:45 +0800 (CST) Received: from SZXEML420-HUB.china.huawei.com (10.82.67.159) by szxeml211-edg.china.huawei.com (172.24.2.182) with Microsoft SMTP Server (TLS) id 14.1.323.3; Fri, 14 Sep 2012 11:21:36 +0800 Received: from blrprnc09ns (10.18.96.98) by szxeml420-hub.china.huawei.com (10.82.67.159) with Microsoft SMTP Server id 14.1.323.3; Fri, 14 Sep 2012 11:21:39 +0800 From: Amit Kapila To: "'Fujii Masao'" , CC: References: <5051CFD2.60103@iki.fi> In-Reply-To: Subject: Re: BUG #7533: Client is not able to connect cascade standby incase basebackup is taken from hot standby Date: Fri, 14 Sep 2012 08:51:38 +0530 Message-ID: <003b01cd9228$0dee98a0$29cbc9e0$@kapila@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Ac2R0ZUk8Po4E35tSRiazE6NB8xIJAAVeoag Content-Language: en-us X-Originating-IP: [10.18.96.98] X-CFilter-Loop: Reflected X-Pg-Spam-Score: -3.7 (---) X-Archive-Number: 201209/132 X-Sequence-Number: 34127 On Thursday, September 13, 2012 10:32 PM Fujii Masao wrote: On Thu, Sep 13, 2012 at 9:21 PM, Heikki Linnakangas = wrote: > On 12.09.2012 22:03, Fujii Masao wrote: >> >> On Wed, Sep 12, 2012 at 8:47 PM, wrote: >>> >>> The following bug has been logged on the website: >>> >>> Bug reference: 7533 >>> Logged by: Amit Kapila >>> Email address: amit.kapila@huawei.com >>> PostgreSQL version: 9.2.0 >>> Operating system: Suse >>> Description: >>> >>> M host is primary, S host is standby and CS host is cascaded = standby. >>> > >> Hmm, I think the CheckRecoveryConsistency() call in the redo loop is >> misplaced. It's called after we got a record from ReadRecord, but = *before* >> replaying it (rm_redo). Even if replaying record X makes the system >> consistent, we won't check and notice that until we have fetched = record X+1. >> In this particular test case, record X is a shutdown checkpoint = record, but >> it could as well be a running-xacts record, or the record that = reaches >> minRecoveryPoint. > >> Does the problem go away if you just move the = CheckRecoveryConsistency() >> call *after* rm_redo (attached)? > No, at least in my case. When recovery starts at shutdown checkpoint = record and > there is no record following the shutdown checkpoint, recovery gets in > wait state > before entering the main redo apply loop. That is, recovery starts = waiting for > new WAL record to arrive, in ReadRecord just before the redo loop. So = moving > the CheckRecoveryConsistency() call after rm_redo cannot fix the = problem which >I reported. To fix the problem, we need to make the recovery reach the > consistent > point before the redo loop, i.e., in the CheckRecoveryConsistency() > just before the redo loop. I think may be in that case we need both the fixes, as the problem I = have reported can be fixed with Heikki's patch. With Regards, Amit Kapila.