Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wf2On-0005Ly-FH for pgsql-bugs@arkaria.postgresql.org; Tue, 29 Apr 2014 07:24:17 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Wf2Om-0002j5-OB for pgsql-bugs@arkaria.postgresql.org; Tue, 29 Apr 2014 07:24:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wf2Om-0002iz-0V for pgsql-bugs@postgresql.org; Tue, 29 Apr 2014 07:24:16 +0000 Received: from smtp-outbound-2.vmware.com ([208.91.2.13]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wf2Oh-0006hY-1S for pgsql-bugs@postgresql.org; Tue, 29 Apr 2014 07:24:14 +0000 Received: from sc9-mailhost1.vmware.com (sc9-mailhost1.vmware.com [10.113.161.71]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 6D97429637; Tue, 29 Apr 2014 00:24:07 -0700 (PDT) Received: from zcs-prod-ext-mta-1.vmware.com (zcs-prod-ext-mta-1.vmware.com [10.113.62.223]) by sc9-mailhost1.vmware.com (Postfix) with ESMTP id 692E418DB8; Tue, 29 Apr 2014 00:24:07 -0700 (PDT) Received: from zcs-prod-ext-mta-1.vmware.com (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-1.vmware.com (Postfix) with ESMTP id 1850012000A; Tue, 29 Apr 2014 00:24:09 -0700 (PDT) Received: from [192.168.1.90] (zimbra-prod-ext-proxy-vip.vmware.com [10.113.63.87]) by zcs-prod-ext-mta-1.vmware.com (Postfix) with ESMTPSA; Tue, 29 Apr 2014 00:24:08 -0700 (PDT) Message-ID: <535F538E.9020206@vmware.com> Date: Tue, 29 Apr 2014 10:23:58 +0300 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.4.0 MIME-Version: 1.0 To: skeefe@rdx.com, pgsql-bugs@postgresql.org Subject: Re: BUG #10142: Downstream standby indefinitely waits for an old WAL log in new timeline on WAL Cascading replicatio References: <20140425174336.2721.61539@wrigleys.postgresql.org> In-Reply-To: <20140425174336.2721.61539@wrigleys.postgresql.org> Content-Type: multipart/mixed; boundary="------------040202090209080500050903" X-Pg-Spam-Score: -7.6 (-------) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org This is a multi-part message in MIME format. --------------040202090209080500050903 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 04/25/2014 08:43 PM, skeefe@rdx.com wrote: > The issues that we are experiencing is with Postgres 9.2.8 Cascading WAL > Replication. If the master goes down during a massive transaction and we > promote the first slave then next slave looks for a WAL log that never > existed, New timeline before the split of timelines. I can't reproduce this. Would it be possible to create a self-contained script that reproduces the whole scenario? Something like the attached (which I used to try to reproduce this). > Below is how to recreate the issue: > > 1. Create M using postgresql.conf_M. Start M. > CREATE TABLE t_test (id int4); > > 2. Create S1 from M using postgresql.conf_S1 and recovery.conf_S1 (I used > rsync). Start S1 > > 3. Create S2 from M using postgresql.conf_S2 and recovery.conf_S2 (I used > rsync). Start S2 > > 4. Insert data in t_test table in M > INSERT INTO t_test SELECT * FROM generate_series(1, 250000) ; > 5. Important: Do not shutdown M. If you want you can crash M by killing > pids. I just let it run and immediately proceeded to next step. The idea > here is to promote S1 before M transmits the last WAL which has the COMMIT > of the above INSERT. > > 6. Promote S1. S1 will change its timeline. > > 7. S2 will not recognize the new timeline of its master S1. Yeah, that's expected behavior, or a known issue if you will, which was fixed in 9.3. However, S1 should automatically terminate the connection, with a message in the log like this: LOG: terminating all walsender processes to force cascaded standby(s) to update timeline and reconnect That should allow S2 to find the new timeline, without restarting, as long as you have a WAL archive set up. > PGSTOP S2 and > then PGSTART. S2 will now change its timeline. However, as you see in the > pg_log, it will wait for a WAL that will never arrive. It will look for WALs > from previous timeline in new timeline file naming format. E.g it will wait > for 0000000A00000026000000F1. You will see that such log exists in the name > 0000000900000026000000F1. So it will wait forever and if you try to connect > to S2 you will see error “FATAL: the database system is starting up” This seems to be the crux of this bug report. I just tested this and didn't see this behavior. S2 tries restoring files from the archive first, but then it connects to S1 and catches up. > Recovery.conf for S1: > restore_command = '/data/postgres/rep_poc/restore_command.sh %f %p %r' > recovery_end_command = 'rm -f /data/postgres/rep_poc/trigger.cfg' > > recovery_target_timeline = 'latest' > > recovery.conf for S2: > restore_command = '/data/postgres/rep_poc/restore_command.sh %f %p %r' > recovery_end_command = 'rm -f /data/postgres/rep_poc/trigger.cfg' > > recovery_target_timeline = 'latest' There are no primary_conninfo lines here, so you're either not showing us the full recovery.conf files used, or you haven't in fact set up cascading replication. - Heikki --------------040202090209080500050903 Content-Type: application/x-shellscript; name="setup_cascading_replication.sh" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="setup_cascading_replication.sh" IyEvYmluL2Jhc2gKCnNldCAtZQoKYmluL2luaXRkYiAtRCBkYXRhLW1hc3Rl cgoKbWtkaXIgLXAgYXJjaGl2ZWRpcgoKZWNobyAibWF4X3dhbF9zZW5kZXJz ID0gNSIgPj4gZGF0YS1tYXN0ZXIvcG9zdGdyZXNxbC5jb25mCmVjaG8gIndh bF9sZXZlbCA9IGhvdF9zdGFuZGJ5IiA+PiBkYXRhLW1hc3Rlci9wb3N0Z3Jl c3FsLmNvbmYKZWNobyAid2FsX2tlZXBfc2VnbWVudHMgPSAyMCIgPj4gZGF0 YS1tYXN0ZXIvcG9zdGdyZXNxbC5jb25mCmVjaG8gImFyY2hpdmVfY29tbWFu ZD0nY3AgJXAgJFBXRC9hcmNoaXZlZGlyLyVmJyIgPj4gZGF0YS1tYXN0ZXIv cG9zdGdyZXNxbC5jb25mCmVjaG8gImFyY2hpdmV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CmVjaG8gInByaW1hcnlfY29ubmluZm89J3BvcnQ9NTQzMyciID4+IGRhdGEt c3RhbmRieTIvcmVjb3ZlcnkuY29uZgoKYmluL3BnX2N0bCAtRCBkYXRhLXN0 YW5kYnkgc3RhcnQKYmluL3BnX2N0bCAtRCBkYXRhLXN0YW5kYnkyIHN0YXJ0 CgplY2hvICJsb2dfbGluZV9wcmVmaXg9J00gICciID4+IGRhdGEtbWFzdGVy L3Bvc3RncmVzcWwuY29uZgpiaW4vcGdfY3RsIC13IC1EIGRhdGEtbWFzdGVy IHJlbG9hZAo= --------------040202090209080500050903 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs --------------040202090209080500050903--