Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gwItz-0002Pz-IN for pgsql-bugs@arkaria.postgresql.org; Wed, 20 Feb 2019 03:50:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gwItx-0003PD-Hv for pgsql-bugs@arkaria.postgresql.org; Wed, 20 Feb 2019 03:50:29 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1gwItx-0003P6-AT for pgsql-bugs@lists.postgresql.org; Wed, 20 Feb 2019 03:50:29 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gwItv-0000up-7x for pgsql-bugs@lists.postgresql.org; Wed, 20 Feb 2019 03:50:28 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id B522622A8A; Tue, 19 Feb 2019 22:50:25 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 19 Feb 2019 22:50:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=nIrh9j7bxYW/hHeR0eTiZ7ZrWJq WA87tQ8tgfv4QiAY=; b=IE6d2PN1qhJiA1AZ1QiwkS+ZkiUYW+nmWfhN1u6Lv8y 1utwZOORqy+UzoDcq9YGG7k0iiTf8AXoi+RrzeHA8XaKO7RudtFhg0Gw5CxvpBlg WbR6M4WUU3r/H16o82qSzYV8Xt04ahNPuxQBNP2SuNok//oxHJw6LENxroXqcZk6 f0pMGWo+IpoxOrUNY3SW+M1rWTRlCo/X5Ek54OOHu7jbvnVpUtPcmOWZJpgPgu/4 6i19bmXxM30s/MmQnZlzXtvzr1656KdlvMzHAV0jzIvIByUcUMJ9u3VhPk+47TW9 jk4gu0W7xLKFFidbRU9uWaMw7upNhWMvYR2VaTV37GA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=nIrh9j 7bxYW/hHeR0eTiZ7ZrWJqWA87tQ8tgfv4QiAY=; b=rON/DqWtttF4sloHdrUyHK hoIgH4tXtmQHx8MrQ6VBehkgzDL8lJ0GSCsyboSCM6GvGEIRNKcPAfRRBGADyZdp 0A1W+W796o3O8z8/UlmYyaVuoofARHmQBYWDDFIs+4NJncYpkRsbjZXmQEU/uZbd Y5VzlnDWElCT7Vi/pWK3PIQhohprzEU89cpgVW/FuRUhVvubtvN2DquC/SGBk1dC kVGicYmkFA5K0G5XhM6kr0WTDygz6w+EC9wVA5/DGxBGoR9i0V419TJYRLS1p8pW fnjHM/kn0wUEZGEEncm9tnT+hkvtez0byuZc+1j1Ph4ic+X1xVsW32YcvHfUiT7Q == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrtdehgdeiheculddtuddrgedtledrtddtmd cutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddt vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucfkphepuddukedrvdeguddrvdehtddrvddutdenucfrrghr rghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiienucevlh hushhtvghrufhiiigvpedt X-ME-Proxy: Received: from paquier.xyz (mp76f1fad2.ap.nuro.jp [118.241.250.210]) by mail.messagingengine.com (Postfix) with ESMTPA id 337DBE4210; Tue, 19 Feb 2019 22:50:22 -0500 (EST) Date: Wed, 20 Feb 2019 12:50:11 +0900 From: Michael Paquier To: Andre Piwoni Cc: Maksim Milyutin , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15638: pg_basebackup with --wal-method=stream incorrectly generates WAL segment created during backup Message-ID: <20190220035011.GE15532@paquier.xyz> References: <15638-426547bdd97938dd@postgresql.org> <20190216152503.GK2240@paquier.xyz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="gnQ/OOKD4CRsnGw/" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --gnQ/OOKD4CRsnGw/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Feb 19, 2019 at 09:25:57AM -0800, Andre Piwoni wrote: > I call pg_ctl -D /var/lib/pgsql/10/data promote to upgrade slave to master > when failover happens. archive_mode is set to "on" and not "always". > I repoint slave to the master by stopping it, updating recovery.conf and > restarting it. Let me know if I'm doing it wrong. As long as you stop the primary cleanly (stop or smart mode) so as the primary has the possibility to send its shutdown checkpoint record to the standby and makes sure that the standby has flushed the record, that's safe. > I think this problem is created before promotion when new slave is created > using pg_basebackup with --wal-method=stream and manifests when actual > promotion happens. > What I'm trying to say it does not seem that .partial extension is the > issue here but lack of .done extension. Well, sure. If you begin by reusing an old backup, you have a risk to potentially archive the same segment multiple times if you use the same archive location for all your servers. Since 9.5 this can get even more complication as archive_mode has gained an "always" mode which makes also standbys archive segments while in recovery to give the users a switch for more archiving redundancy, which is useful when working with async standbys across multiple sites. My point is that this stuff has always worked this way. And people around do not actually complain about the difference made for archive_status/ when using the stream of fetch methods with pg_basebackup. From what I can see as well, your archive_command is actually unsafe on many points, so my take is that you should more carefully design it, or rely on an existing backup solution developed by experts in PostgreSQL backups. And no, it is not safe to change a behavior that other people may rely heavily on for their solutions since pg_basebackup got smarter with its stream mode. -- Michael --gnQ/OOKD4CRsnGw/ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAlxsznMACgkQnvQgOdby QH0wxg/+P3HqIvResmSP/IC7RirOKwOMp2AXDb8XjkaYfjNrOj8zZ94kS0+uVcZA 6PWsjhjUZ8yEzSYi2qxzIoWOhmB8nq3FlldcpcVa7f3JYdc+yTR5EzA4BcKQbna+ HgCGwPqQFBg5ZhS4GCThHpxBrQWFiaLZgB7DulCzuk5jp2npHMRYfH+xDRMCrekf PFFAiV3wMikZb+7PL8SIiEn9zN+5O+seGGCLXw1FSToGRYP7OKUVco1luLy4/Ody 7zT1xQg6CEMw2h+/OCwRkwRqhWYQEIgufUYVw/SORU26+ANndD/eLDZ0ibDkk33e TIvh09EZRZ1BrzVGyPGglmQijEl02Tl+dMFC+iIOC26uDapNQL3SAQ9PFo1DuJOH BbzzcmDDv0Yqd4L0iTGrQXwiIyBHra1J+40rVGYJuYnEzg1SGoylj3At7cGQHwa4 tYoSngZgoZxicEbVF7kDyaVXFS8zFC8aN5T/WX7/Yf3a3oCSZNJFYhHHZ55huJ9h Ozcscjm8xIwZiOvj6CjV+nlYujJhZaQVoSYKkOXRBZOxKK0Z11QBliAhDA8MvzyP IR2SN8aS4W2cwWIVU/f23Fi+EtgUPKlt9wQEwI1tMeoLdXiJStzIzTEXkNtZd/LX QPbAaxfBPAZ+LVlkzpuxdjBDNoW14M8ppg6I9FQ/Gqugyr/+8vU= =p/2j -----END PGP SIGNATURE----- --gnQ/OOKD4CRsnGw/--