Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bKoxj-0008Fw-JX for pgsql-bugs@arkaria.postgresql.org; Wed, 06 Jul 2016 15:42:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bKoxj-0001tE-6g for pgsql-bugs@arkaria.postgresql.org; Wed, 06 Jul 2016 15:42:07 +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 1bKoxh-0001p9-P1 for pgsql-bugs@postgresql.org; Wed, 06 Jul 2016 15:42:05 +0000 Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bKoxb-0007v0-6X for pgsql-bugs@postgresql.org; Wed, 06 Jul 2016 15:42:05 +0000 Received: by mail-wm0-x22b.google.com with SMTP id z126so116606318wme.0 for ; Wed, 06 Jul 2016 08:41:58 -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=kABZ6bPJxbKJHn8yi0TmncngFazhgLMK4XC8uz3BF+0=; b=VgNibdXLuq5ekH4m50mONHdunKnP0l1O46NqlMaCXSZl8FnMpKv5skG6rE+fKoSSXF EvLwvEzGQcVpbXKX4/QBOiMta581i7QkIKS7d36qDyWAGQHq+9wJcrzDyzB7Vv1DcM9c /VuOfxvQC+15lWLZns1oUEKCGtgsq3l+F+Si4= 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=kABZ6bPJxbKJHn8yi0TmncngFazhgLMK4XC8uz3BF+0=; b=HSawEEVt6rOHTHC1YE6hQ1uTzWiCqaibHVXm4HksiaAmabHxtwZP1Y/1pwwp5caFm1 Hl1Rc0e1rIA18ILN9Q8V/NIPdtRVkWNAu6ECEhkDUDG+Fv6sS9OK8EeUJ/HIsG5AcZWq oU/VyvVW+h8Gdo+ReHV0yesOVW7oFPh9UivdnHKplIi3cFwTMbvX0YRUUuka/j+1uneb vOhWsbuzjyafXD4LZAMFiAm/c3zRrZSDlY+YBiuXosFUMB/AW/ZjMuXdSgt6El+lyIZs ztefE4uQ/QeQbH6aL6QpQhz0ukOA1RDQylbvP19xpb1XYbCiwNxrnARIOYFL94PLB3Hj 7awA== X-Gm-Message-State: ALyK8tIN8aS/cdKYLKe4Z9PuG2j4mIs41SYzi8STucJux4vgnT1cpTGB7jIpVu4hUmFCZ9pW X-Received: by 10.28.203.205 with SMTP id b196mr22317746wmg.34.1467819718346; Wed, 06 Jul 2016 08:41:58 -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 bh7sm3001615wjb.22.2016.07.06.08.41.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jul 2016 08:41:57 -0700 (PDT) Subject: Re: 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:41:56 +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: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="JnvQCOevDnHms1b8Ig34DgmFJcHFSlLSV" X-Pg-Spam-Score: -2.7 (--) 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 an OpenPGP/MIME signed message (RFC 4880 and 3156) --JnvQCOevDnHms1b8Ig34DgmFJcHFSlLSV 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: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/07/16 17:37, Marco Nenciarini wrote: > Hi, >=20 > On 06/07/16 17:07, francesco.canovai@2ndquadrant.it wrote: >> The following bug has been logged on the website: >> >> 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 >> >> I'm taking a concurrent backup from a standby in PostgreSQL beta2 and I = get >> the wrong timeline from pg_stop_backup(false). >> >> This is what I'm doing: >> >> 1) I set up an environment with a primary server and a replica in stream= ing >> replication. >> >> 2) On the replica, I run >> >> postgres=3D# SELECT pg_start_backup('test_backup', true, false); >> pg_start_backup=20 >> ----------------- >> 0/3000A00 >> (1 row) >> >> 3) When I run pg_stop_backup, it returns a start wal location belonging = to a >> file with timeline 0. >> >> 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 >> >> ------------------------------------------------------------------------= --- >> (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) >> >> The timeline returned is fine (is 1) when running the same commands on t= he >> master. >> >> An incorrect backup label doesn't prevent PostgreSQL from starting up, b= ut >> it affects the tools using that information. >> >> >=20 > The issue here is that the do_pg_stop_backup function uses the > ThisTimeLineID variable that is not valid on standbys. >=20 > I think that it should read it from > ControlFile->checkPointCopy.ThisTimeLineID as we do in do_pg_start_backup. >=20 No, that's not the solution. The backup_label is generated during the do_pg_start_backup call, so also the copy in ControlFile->checkPointCopy.ThisTimeLineID is uninitialized. Regards, Marco --=20 Marco Nenciarini - 2ndQuadrant Italy PostgreSQL Training, Services and Support marco.nenciarini@2ndQuadrant.it | www.2ndQuadrant.it --JnvQCOevDnHms1b8Ig34DgmFJcHFSlLSV Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCAAGBQJXfSbEAAoJEFifA/AbpVA4508P+QGQ9WmZINX92dnt2hzaQWJw eFNeTFC91JZsVH2RHcJ6ZbvMx64Wpd8V+opAN0u8IAODbjbeU9sGkJL64Dnb7gzL I5tPLTlurEDtSicX6FSNhNK5hPxTUoi0dGMkm0X/ELaPS4muOdOIX/KhXeJ5A33B vgACpm+bxfFls82VLLIA9JKpgzjlQlhF77m6e5M0awcP1R8h7Qu1kXjIhYZ40nI6 7MKrpuG0eYPXTBS6yHYMZb7KzLSW3xpyY6vhiDqqmdPratbwOR7P1JMHoiCdDaTk 9Z7gpoK1F65LSrbyYdm/2GN7bUrj6XdzsAkhidCzR5ddtEbj+wvuqyl0+f+W66ns nZ9HzeA6RvcCnkcBGKH7gmd2taTCWhFYZt1P2KPw/zbxs6ahBBBupsQhjDEGAsOS VdfT7lW3RS5ZoSAhBl3A6twsdul2l9xTkNmOjkwd63RL2Bgby3dDfPTIzY1gHcmd KBGH5+d3zPWK7C+Vpu/S2Wyuhqbry+Wp4VBdZ1hIhPrXAmyLdvj9oaSfD/qEnU1L /3H5tNnsjE1Myblx1+o0p025v7XqS/EZNi9fFCHA1E40d+XImHQYsy9HjV9cQNCr ZI9avDWvGIClzROngREVB8L8hlzgVIiceZS+dhBBg4h0dRAu9x32sNrXpU9pKMO/ F/0Edr0yqD0zd0FeJY/J =bi4b -----END PGP SIGNATURE----- --JnvQCOevDnHms1b8Ig34DgmFJcHFSlLSV--