Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bKotp-00083y-AI for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Jul 2016 15:38:05 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bKotn-0007m4-Uw for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Jul 2016 15:38:03 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bKotm-0007lH-L0 for pgsql-hackers@postgresql.org; Wed, 06 Jul 2016 15:38:02 +0000 Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bKotj-0007oR-V1 for pgsql-hackers@postgresql.org; Wed, 06 Jul 2016 15:38:02 +0000 Received: by mail-wm0-x22f.google.com with SMTP id f126so178495729wma.1 for ; Wed, 06 Jul 2016 08:37:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant.it; s=google; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to; bh=FdInqbMJ2cu/+rFIxtBK5H9X7XYfspchHaeJQQQzei4=; b=L3aEZ11qtVXyh/zFpalOgTcCkNeXQN9En7ax1/FDtwOwP+vIFCR+LAjLpFg/BN5sjr YshHIQho3iGrBHfpxpskmo6Ev+KN8M4Kmg3sLGaETiFhsDlTvS1mbIqg5eVkE7JugHof qNxb8EMsejMh7Sh3aNj0Fc/ju5/+PwH7eH9N0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to; bh=FdInqbMJ2cu/+rFIxtBK5H9X7XYfspchHaeJQQQzei4=; b=FCe2vAevWMkw1V+gnPaFqCPAPRrhcTqmnwr0/PcM2JdxqQXBBtve+zLvjET6bkkjJk DUyboifPJHpP7rB1cFcaF3aKwK+ZY6XJSzC2iQUpAz3hh+U2na9KadXR1TLSFyrJ9jlo vt/l5Uiv21N7JygxY7ov7NA0JZ4SFsMwNfc2SWZ7eFkZFSecnBrFtqjAVdNmKiWYpz+y I4L08X08JdRZezO+jthXkdb1mOl59rJyT06d3VcWfWwE5HkBl0npsVNfXn7O/FzyZgxq 5cHBCOHDYLAagj8iVnnkIH5s2Sih5k+4uCsBnu3RYeISFIyuoVEH6A+/QUXeNpWzNlGk qGvQ== X-Gm-Message-State: ALyK8tJznALd21NcL8SDZgEKxp7HS3lqH+qFCw4gjpsk5vQ7M0i7F4DnAMjSSj9MoS1EvF4C4QLYzAxgJ+URc+DZ4Oy8I0XLSJB/VLeJmlTskkx8SnBUNSAikumhTWY+dk8/6uwXvoympPQiNmwQffVsbwHo4FCURnJbA1n/Wi8y5RZFWxRQ+aTTdVfYn0bpZBYMHwSUnYHBno9p X-Received: by 10.194.30.36 with SMTP id p4mr11960317wjh.59.1467819477673; Wed, 06 Jul 2016 08:37:57 -0700 (PDT) Received: from titanium.local (net-37-182-231-222.cust.vodafonedsl.it. [37.182.231.222]) by smtp.googlemail.com with ESMTPSA id q63sm4337279wma.0.2016.07.06.08.37.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jul 2016 08:37:56 -0700 (PDT) Subject: Re: [BUGS] BUG #14230: Wrong timeline returned by pg_stop_backup on a standby To: francesco.canovai@2ndquadrant.it, pgsql-bugs@postgresql.org, PostgreSQL-development References: <20160706150739.1426.84965@wrigleys.postgresql.org> From: Marco Nenciarini Message-ID: Date: Wed, 6 Jul 2016 17:37:51 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <20160706150739.1426.84965@wrigleys.postgresql.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ojIdTQdp5r8vuxtvqBd6s1DtLOMSg3je0" X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --ojIdTQdp5r8vuxtvqBd6s1DtLOMSg3je0 From: Marco Nenciarini To: francesco.canovai@2ndquadrant.it, pgsql-bugs@postgresql.org, PostgreSQL-development Message-ID: Subject: Re: [BUGS] BUG #14230: Wrong timeline returned by pg_stop_backup on a standby References: <20160706150739.1426.84965@wrigleys.postgresql.org> In-Reply-To: <20160706150739.1426.84965@wrigleys.postgresql.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, On 06/07/16 17:07, francesco.canovai@2ndquadrant.it wrote: > The following bug has been logged on the website: >=20 > Bug reference: 14230 > Logged by: Francesco Canovai > Email address: francesco.canovai@2ndquadrant.it > PostgreSQL version: 9.6beta2 > Operating system: Linux > Description:=20=20=20=20=20=20=20=20 >=20 > I'm taking a concurrent backup from a standby in PostgreSQL beta2 and I g= et > the wrong timeline from pg_stop_backup(false). >=20 > This is what I'm doing: >=20 > 1) I set up an environment with a primary server and a replica in streami= ng > replication. >=20 > 2) On the replica, I run >=20 > postgres=3D# SELECT pg_start_backup('test_backup', true, false); > pg_start_backup=20 > ----------------- > 0/3000A00 > (1 row) >=20 > 3) When I run pg_stop_backup, it returns a start wal location belonging t= o a > file with timeline 0. >=20 > postgres=3D# SELECT pg_stop_backup(false); > pg_stop_backup=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 >=20 > -------------------------------------------------------------------------= -- > (0/3000AE0,"START WAL LOCATION: 0/3000A00 (file > 000000000000000000000003)+ > CHECKPOINT LOCATION: 0/3000A38=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20 > + > BACKUP METHOD: streamed=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 > + > BACKUP FROM: standby=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20 > + > START TIME: 2016-07-06 16:44:31 CEST=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 > + > LABEL: test_backup=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20 > + > ","") > (1 row) >=20 > The timeline returned is fine (is 1) when running the same commands on the > master. >=20 > An incorrect backup label doesn't prevent PostgreSQL from starting up, but > it affects the tools using that information. >=20 >=20 The issue here is that the do_pg_stop_backup function uses the ThisTimeLineID variable that is not valid on standbys. I think that it should read it from ControlFile->checkPointCopy.ThisTimeLineID as we do in do_pg_start_backup. Regards, Marco --=20 Marco Nenciarini - 2ndQuadrant Italy PostgreSQL Training, Services and Support marco.nenciarini@2ndQuadrant.it | www.2ndQuadrant.it --ojIdTQdp5r8vuxtvqBd6s1DtLOMSg3je0 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCAAGBQJXfSXTAAoJEFifA/AbpVA4Cq8P/RBttrCICiUM6neA5dfRs5VW +ul+rYpMQcSBjr6Z9VAgeZiQnetCTcgE7JIWoUS2LKM44pDB/QSYCKZbYRy3iGPm ECYAZNxk3ZZHi8lrJHyzSJ86QqAozCXgQSYz/9utzZNaD8g1riLZ9GQ6b1zeGeuQ mxzCPcl9H4h/xWee4k7LGkICyZNs7QjI29Tk4ugzdlZXuuGricUzaQrcHZiSMMNH nXx0OgzcetoELnEPCArq6eKbd5vbdXyJOLTeEnK1Bcl2Dy+cOmGSvDbLDa49Wtn1 oJvp+vu3+5j4qdwpvLCwH1V9x4cjxSg9x0Ke/LrdDMr6ZU1qERSRWHxYi8cgXOcd 8NeNrVPsEeKGcyq5RIkB4sK23wAayPWJLvOlSSXh+F++LyrBje6GCTkq7W5gTDqQ /83jN9uR8RC0SzStkPyqFgGsewvpjeKvTbhDGmoUBV/eBXwbiupxkP8ZXgwzie1+ gwoBgigf1e/UJ4bvGOEximXcsXTsaRO+EWmFEGP1zMosIzotO2XXUHbrOp0MVqDk vqGprhFJd1HJsX84n3dSOxynraT3ebuqyUOAA5Wlg/w+v9m7f9tYrm9zsK1zAlTS ftB7cYswe1aEBOr0U6RjwuT7Mgh4ZQLEAaXZpo6cS3z55FPm0DUOzkCXC5A5M6Mc C+BEfVCkknkeKZniEDpt =xKdM -----END PGP SIGNATURE----- --ojIdTQdp5r8vuxtvqBd6s1DtLOMSg3je0--