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 1g2SSF-0005Hb-8C for pgsql-docs@arkaria.postgresql.org; Wed, 19 Sep 2018 02:43:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g2SSD-0006ys-4L for pgsql-docs@arkaria.postgresql.org; Wed, 19 Sep 2018 02:43:01 +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.89) (envelope-from ) id 1g2SSC-0006yl-UH for pgsql-docs@lists.postgresql.org; Wed, 19 Sep 2018 02:43:00 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g2SS8-0000kM-JK for pgsql-docs@lists.postgresql.org; Wed, 19 Sep 2018 02:42:59 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 5606021F6B; Tue, 18 Sep 2018 22:42:55 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 18 Sep 2018 22:42:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= 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=MRmF2K4VGKeTiC9mhvfA5YzxKuLI+vD7WTMnoI9saC0=; b=TBCgpmQt QXN1AxCR0tfJOhwRVtI8FFDVTp+Z/CiRTEMckC1OOoxfQoovjIufbmf/HKRdfbCn b9uywWKA2UtpEMThG06w/E2FUhBZARcrOWC5zebKfCbtt8bXKWhMOEgHbhbVc4SO 3gWw77u7/NKJ3a27DcDiGOboaXbh15b+p4lj4WJ0YXBq5H/88Q2zTmZr3uYBsNKv rZJEzrRp24D5IngGryZ5OJTjpsLLe2HrmGAyEWd/U3YRLnVixKYhri6iYmBpiJXH 7aP+8OIuKTVwWFKyI+QJ4UQKaUZZWHzkfmERE6wjQossf2Ykb3Iafa5BJO2hPzCp zV1ErX2JirLDXA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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=MRmF2K4VGKeTiC9mhvfA5YzxKuLI+ vD7WTMnoI9saC0=; b=EqicDsDc4UWNex8qho6ux0PCVhqC3hZG2cQrmXdcqgH9d GWsumNbPtVS9dkw26hTPMoRDqkwud3fsN4hWoqLXs3i7EC0UwA+e5CEmbrAtc7Hm qorbFnRKrzc/m2Msjdvx0WDnUOIcCcg9U+1WO9FvPWond9WVzCcO4aEn+JSbsS74 AQPM5do0VBmgkAS2x3i4dM4QeyxgEcaEROfzSE6byXKNPt6VRLxCSatZ38yo/r9O guoPFiJLEruV3AdK7UywoVQaakFlbu/EvuucabpDBgCocsdX9S0yDbqSeNpWLRg7 LclrDakRXsiLXhO1As9PqC/QWeuROKpGDgtu+mtQg== X-ME-Proxy: X-ME-Sender: Received: from paquier.xyz (c137162.net61215.cablenet.ne.jp [61.215.137.162]) by mail.messagingengine.com (Postfix) with ESMTPA id 55665102DA; Tue, 18 Sep 2018 22:42:53 -0400 (EDT) Date: Wed, 19 Sep 2018 11:42:50 +0900 From: Michael Paquier To: cjames@emolecules.com, pgsql-docs@lists.postgresql.org Subject: Re: Ambiguity in restore_command for recovery.conf Message-ID: <20180919024250.GE1650@paquier.xyz> References: <153728701749.28483.6427522510493541629@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="NQTVMVnDVuULnIzU" Content-Disposition: inline In-Reply-To: <153728701749.28483.6427522510493541629@wrigleys.postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --NQTVMVnDVuULnIzU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Sep 18, 2018 at 04:10:17PM +0000, PG Doc comments form wrote: > Documentation for restore_command in recovery.conf only says, "This > parameter is required for archive recovery, but optional for streaming > replication," but it doesn't say specifically when the restore_command > string will be used and why. My guess is that as long as the WAL files > are still available on the master (primary) host, the recovery will > fetch them via the replication slot, but if a WAL is missing on the > primary, only then will the restore_command be used. But this isn't > explicitly stated. It could be that the restore_command is always > used, even if the WAL file is still available on the primary. The logic around the source used to fetch WAL segments is defined in WaitForWALToBecomeAvailable/xlog.c. A standby would give priority to what is present in the local pg_wal or in the WAL archive before switching to streaming. If fetching a segment from the archive or the local pg_wal fails, then a switch to streaming happens (of course if primary_conninfo is defined). There is nothing really linked to replication slots in this case. -- Michael --NQTVMVnDVuULnIzU Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAluht6oACgkQnvQgOdby QH3I/Q//fjMcudB2E8CqJSULTyc7Co2CzzliikCOVcWIYw7rOazYw254e8LN+913 OSWIZc5CNH0Ob455d3RybyUABaPXYJi7E9ZxN0rM4jFFrj7SPjSqmir+9v2VnOKd D3w5VjwLhAlxeTeKACzZMdOAaKYmIUQor9C4LVxYmjuMY9TnpJikur/1nKrm5+R+ XYDWN9pNxC75oj+6C4YGfyx+6vl5GhinSVGcnGuST6c4YqYGGOotdiIGua4EnrX/ Hx5+8BI6BA61vMkVwlqhOsBv0aSzTkt7Vlo838gGCuHNVVG7jv8Owhkd4p8oR95R uZ/vvZx0bDhZl1W9Sl/XH1pNEbAxu9+Ss5fy/gMU6IDtfyA3W3IbVdYU8lL4p3/t 04Idd4PMxDqD7i7GLTs+UZYXemxgF403vG7PVeT7n6S5CB2DjazmLuG//GwkF5Ba 1vBzBsde1lpiNBk5epquVOtsb04WQB7NlCYp8HbDT13Kz2O7vgqd2yD37CTGLb1l ti06w5/nQDBhwwUPILgXO4ZJAw43Gr0h7w1X1hVhsfv5CeY1EoLAEIbL8DBtwcwf rZ+sCkhpas0nlYfnECeXS5M1M8Jn/7cEiq9BWP9crMUNJ4w/D4dD3WF5BJ4ClJXz /du2wkohyGe8dXs/kKTvhzEoZDMzu18KpOKK4ALUgwzg01kT9iQ= =KnqJ -----END PGP SIGNATURE----- --NQTVMVnDVuULnIzU--