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 1fudbB-0007FN-Tk for pgsql-bugs@arkaria.postgresql.org; Tue, 28 Aug 2018 12:59:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fudb9-0006Bd-I4 for pgsql-bugs@arkaria.postgresql.org; Tue, 28 Aug 2018 12:59:55 +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 1fudb7-0006BW-WA for pgsql-bugs@lists.postgresql.org; Tue, 28 Aug 2018 12:59:55 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fudb3-0005j8-N6 for pgsql-bugs@lists.postgresql.org; Tue, 28 Aug 2018 12:59:52 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id BB3CD21924; Tue, 28 Aug 2018 08:59:48 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 28 Aug 2018 08:59:48 -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=a+n339AQM2d8C11YZ0YQefjnNs0XTAsQzAfZtw6Gsgo=; b=hpp3SZJ4 l+EjEdZLymup2Y1bDtK33LUwtY5OAZpN7uPPq6swVgLw7VrPjA0Q1hs4oeLNA97M ixGhWru+YSAu2WqtWvm7/KxVC6JftAWj5mDANfdBCrO/6jgENPjkXYh9J91Noi76 NxImSEnaKmMtoe+cozY03TgGQNxyfZCz5SIMIreT5q5j1uuKcjWJDdSW/Dqg1INP XXGgowSqOJAjnqu1U7FbxR+vd9lx5d1PviLBD6FpgypA/w7Ab/4Q3qhsVrlMSPG8 4iE8nxWCpV3hsyUFP36MHgmkIITnURbc2GKxLvZPmD29+U99nrtjylKX5T5F0r9d FFbjKjJMl7UEpA== 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=a+n339AQM2d8C11YZ0YQefjnNs0XT AsQzAfZtw6Gsgo=; b=GkjF00L722POfHM8oE3V3Jbq+J3lVVW2pIM0jZH3szxou jayeZqv4sGs2faLzOZqh9TsMZtRhX72o13Q8eFMo3T5w+wEKPKI15TPcluYxOadf ZQ51y227TSfC39gd5veG2k5qD7bM5rC8ay2mp6ZJkJw/I7kImneOwJjLPzMEwRt9 EaF/04ly35PHB4dvhz0/seK6RgwTdc04EXtrx84Nrcaz3xqO9KadCmduFRqblgDy oZiHd6xhXPTEZObdUxI11sLh7CkjbbNpqqpvFIwjYoMVee/tDEJa4ynyLldYhzuy vyTfHFqH8uBnNCBTzZrIMhP36vVkzbZYAP5MOhxbg== X-ME-Proxy: X-ME-Sender: Received: from paquier.xyz (unknown [66.201.48.83]) by mail.messagingengine.com (Postfix) with ESMTPA id ED3EF10289; Tue, 28 Aug 2018 08:59:46 -0400 (EDT) Date: Tue, 28 Aug 2018 21:59:45 +0900 From: Michael Paquier To: Stephen Frost Cc: Andres Freund , pgsql-bugs@lists.postgresql.org, Alexander Kukushkin , Alvaro Herrera , Dmitry Dolgov <9erthalion6@gmail.com> Subject: Re: BUG #15346: Replica fails to start after the crash Message-ID: <20180828125945.GG29157@paquier.xyz> References: <20180822175034.lnvwk5js32k6mjyz@alvherre.pgsql> <20180823041420.GA1158@paquier.xyz> <20180828024409.GB29157@paquier.xyz> <3B69F535-FD81-461B-97E9-657D4C99EDB4@anarazel.de> <20180828122311.GD3326@tamriel.snowman.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="OpLPJvDmhXTZE4Lg" Content-Disposition: inline In-Reply-To: <20180828122311.GD3326@tamriel.snowman.net> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --OpLPJvDmhXTZE4Lg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 28, 2018 at 08:23:11AM -0400, Stephen Frost wrote: > * Andres Freund (andres@anarazel.de) wrote: >> Uh, where is that "control file last" bit coming from? >=20 > pg_basebackup copies it last. The comments should probably be improved > as to *why* but my recollection is that it's, at least in part, to > ensure the new cluster can't be used until it's actually a complete > backup. What we have now is mainly in basebackup.c. See 8366c780 which introduced that. Stephen has that right, as we cannot rely on an end-backup record when taking a backup from a standby, copying the control file last ensures that the consistent point should be late enough that no other pages are inconsistent. Even with that, I think that there is still a small race condition but I cannot put my finger on it now. I agree that the current comments do a bad job as to why this happens. That's actually something I discovered when discussing what has resulted in f267c1c2. -- Michael --OpLPJvDmhXTZE4Lg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAluFR0EACgkQnvQgOdby QH1C1xAAm+mm89yd36CDCUuUwWxgg6tcWBsBS4VC5RBfwv+4jj1ZCleRxJPrn7hZ APwNZZOxNfWEAk93b1bmQq4w4wzSDLM512jeg7SIrcK4FCCOyvvOALf2AsbDu+zS tBg1ny7tH0Y9NQuB8pOos27xrDlAXanYJ0dlwsVuxE3bWU/ylIKIhumVqsa/ZGgL w7RP9AnShPArIBKr1iVNimIEFEQKIrULQ2SedGE2FWz/eeq51oj+YP7fkRq1V3pQ ceVYGBfsLSwA6WYPRxJByXkF+PkZbo7V89a0cIvJimxfGXQEc1Ue7J1sKNBqpGzm r4t74Umbnbe+Rc81RONRrEsfMFeWkoCH5vm6jQNB7ovWd01nPcH6aWeazrAnrOgK ZbQdnTN3WOD7JilbNH+Fek20xpLvnE1hlfRuKBbl2DZfa/Pcswa4RmSkLfZUGoSx CIJCeJpG7S/FeCxJDTM6PrB8/bsAhnq2SkYq1Jo7xIz6JsYjj4hlviQkPMeXS9QM 0HC/QnRnTf1PgZ2QUA0D4hG6LMqnu8ywmIOv/JA76zq3W7Ya6J+w1EVK0r+VoSB+ os7mEIZ1DqOC/M61EDON5quD5ZXpYFObbx3+m0C8KZZ61yXlrdt1nyCZaQUhbCft T+bg97JEdFxMqZYFf6GUQYdO59BpqkC/LU+WJxvL81wsUg8IOMI= =BQlz -----END PGP SIGNATURE----- --OpLPJvDmhXTZE4Lg--