Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1flhAa-0000h0-MS for pgsql-general@arkaria.postgresql.org; Fri, 03 Aug 2018 20:59: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 1flhAZ-0004Jo-9O for pgsql-general@arkaria.postgresql.org; Fri, 03 Aug 2018 20:59:31 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1flhAY-0004Jh-Ts for pgsql-general@lists.postgresql.org; Fri, 03 Aug 2018 20:59:31 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1flhAW-0001Se-FZ for pgsql-general@lists.postgresql.org; Fri, 03 Aug 2018 20:59:29 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 7227521D; Fri, 3 Aug 2018 16:59:27 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 03 Aug 2018 16:59:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=+artbqR6voV04ffH3S26T7u/RmaUowJtFDOx/jzC3eg=; b=yK/qZnBt d99OTS91fq8TrBuB5eVNaCDywJ78M1ztIU4jCCuTYGQbiGytxRX/KKG6a+kPthEF Q2Q2L6f9Rxr9QsmvSz9XmL2GRGWOyQjThYG9otrtrRU8o5BmIbWg2WB4QpLtdJvq LC8HASGQZ7KbpdoAd1wjsV1w9k0QR2Lq/fT3GtRo2wn384fixRBplAMYQalTcjWN 0a5yc95gSCtX3asMDcH3tRaPed8JllGFQZcx4zPZJ9pHydgyPRLdYt5HjilOwHMv Xb47/UoC4hKWvK4eUZDvQ4hrZQs1hRgb1Ma+0q2efT/x4itI+KNPWf/rx9g3heFT jpEf5i1QM27F4g== 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-sender :x-me-sender:x-sasl-enc; s=fm3; bh=+artbqR6voV04ffH3S26T7u/RmaUo wJtFDOx/jzC3eg=; b=FoMM/mEwNPF1fXwa8OPwcpd2E5ekcjZsOi3UWJeBHTBqs vyhfD3nFzZS/Jfw78iCYbSfBR4yp6bI5ed2s1D76yGNr0XBp5lDUxYXkF9+1ocXb 3q6YuEsaSm6JmBeoS238KgkhN4xSFQck2tZDuoU9z7xv6WtCpJt5zsmbvKCKTLu3 imJ9RkfQMC+N+MPVDREdCfF/qDgq3Vk1NAIesrsjgkhfzP4scqdLDmMrj1a6h5pq zlIM4AWV5FFwsT+6bS5jpaB6WAiCLfYSD9SATjrWSn2WT8f1216BuqK/nlH3mujd jSNBG1zBVmrqJofXhiIZQgwZuI3qroCUJnt7r8Jxw== X-ME-Proxy: X-ME-Sender: Received: from paquier.xyz (lfbn-ann-1-147-30.w86-200.abo.wanadoo.fr [86.200.114.30]) by mail.messagingengine.com (Postfix) with ESMTPA id 5650610255; Fri, 3 Aug 2018 16:59:26 -0400 (EDT) Date: Sat, 4 Aug 2018 05:59:22 +0900 From: Michael Paquier To: Richard Schmidt Cc: "pgsql-general@lists.postgresql.org" Subject: Re: Pg_rewind cannot load history wal Message-ID: <20180803205922.GC20967@paquier.xyz> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="L6iaP+gRLNZHKoI4" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --L6iaP+gRLNZHKoI4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 01, 2018 at 09:09:30PM +0000, Richard Schmidt wrote: > Our procedure that runs on machine A and B is as follows: >=20 > 1. Build new databases on A and B, and configure A as Primary and B > as Standby databases.=20 > 2. Make some changes to the A (the primary) and check that they are > replicated to the B (the standby)=20 > 3. Promote B to be the new primary > 4. Switch of the A (the original primary) > 5. Add the replication slot to B (the new primary) for A (soon to > be standby) > 6. Add a recovery.conf to A (soon to be standby). File contains > recovery_target_timeline =3D 'latest' and restore_command =3D 'cp > /ice-dev/wal_archive/%f "%p"=20 > 7. Run pg_rewind on A - this appears to work as it returns the > message 'source and target cluster are on the same timeline no > rewind required';=20 > 8. Start up server A (now a slave) Step 7 is incorrect here, after promotion of B you should see pg_rewind actually do its work. The problem is that you are missing a piece in your flow in the shape of a checkpoint on the promoted standby to run after 3 and before step 7. This makes the promoted standby update its timeline number in the on-disk control file, which is used by pg_rewind to check if a rewind needs to happen or not. We see too many reports of such mistakes, I am going to propose a patch on the -hackers mailing list to mention that in the documentation... -- Michael --L6iaP+gRLNZHKoI4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAltkwioACgkQnvQgOdby QH1MwRAAoS1XNJgt5lQOkdpw9SJQikXuGv/7S0N65w0m0Vw9Cr18UxpC9FE3g/SX RizOg/SMQB+E6oUKnIMq5pxFv9rnz+iVUl/Nkl4+JnHbQkrcfkLpxN14FQWlF5VA RFgxfbSgHz0EiBuFX49sUkqVxRuxAMgcr+up5XvYIjFz0tuosyk8L0iu8S/dr+cA HbiAJHkdWXDIFF/ZPWeLOnSgVXaKXSHAVABG51vu5XveuCZ8+D/MJQsM1f5TQYoF cgwuHP77+vbGgxHINTN/KUkhyrLRy08rMiC/8ESIyIGtViUj622FL6bhSMrlnlYp WC6a1XElBLGpnOLXrrqPUH7c6ecbNUDqg8HwPIO05NUBZ/ac+72tiabW36Ak51Qp 3EEBrpav/p5Ahl4q3B1MYwrwgHgcQuCDhZWXlEG2LjBmtj7VPXQNP0eows6idO/9 aYQ8JMQhT5TEXn3qSIpX6s21ArOKYQL8DbOKq6xMm14rzfKar1x3ShLyIlcGspcQ lS0P6+YJpeSEE956OvH2nyRcAOLS+OjO8FvpnPQCHC28wjECYY846PrRE0/Qo+vf NPwUBa6SvLW3ZntOiOWm+CtQltKxx4lJcbZIqXzFuFvUQQkzMyk2WClTCCC68nTR NhKtSIvyWDsAWCCPhlkjmO7xcscDpeK60X8t7BnLVEx9E0CjU04= =m4aX -----END PGP SIGNATURE----- --L6iaP+gRLNZHKoI4--