Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r1JGg-00AUAh-J5 for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Nov 2023 04:37:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1r1JGe-001RGP-Ss for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Nov 2023 04:37:16 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r1JGe-001RGC-Ev for pgsql-hackers@lists.postgresql.org; Fri, 10 Nov 2023 04:37:16 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r1JGb-004qXQ-GG for pgsql-hackers@postgresql.org; Fri, 10 Nov 2023 04:37:14 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 375443200B0B; Thu, 9 Nov 2023 23:37:12 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 09 Nov 2023 23:37:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1699591031; x=1699677431; bh=sq NVpXH1jEq8rnUixxEvJdR/NWNO1lThg7iEm7ssbNw=; b=vA9cooGl8exS/utan8 q93vOBO1GTJlA7gbI96iV+Ma+bwtl4gfvP4TuWTZUozW1lPND4ilD1EAiFEo6KEs 6Upl0l/J9/j2HtyPvQ51L5jZxJt5u+dxbe2xnoDmPKRB3aBGO8Xk5NO3UTXRTPis al7g6cXFpPrjMIQGnlFckPqi97P2/ArZ+r0KSNWbQOTHqhjW/73c8IWQZTvtovXU Fx7twwcZX2higdhZE3vcAiNKdo5AbxHF5/j+7JBPgwZOh3K50MnhkRKpHRnGkR2q 0z+xKbaB01U2YsDk6UC8G/GOLkMM2lDyw8e4BxiWhz9mPGzvCu1GIIWTUaCNazIO E4ng== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1699591031; x=1699677431; bh=sqNVpXH1jEq8r nUixxEvJdR/NWNO1lThg7iEm7ssbNw=; b=OOTGZQU9aq9YItHeKdCQOn2oEIPp3 RYPMjjZWOh2JmEu1fi0B4HGLf/3n0lWBe0DR8iCZPmv43+16Va1C1xXRmmYjTbK5 WP48e+tCS4h5bhG2ZP7aSMJf97qXlE+Qa5JDhGysyA22bk+cbpmCU7u2cwPVb2R6 TAY9rRaTPfcyqwrR01IiAIU85DnGYHr6/RnDHsUSY0cweWCLgZdqlHaQNmaAXRDt Q2q1pDg15ydmhtdQZdLjqKX2vN9dFICR2s45Xw5FXvdGlk0OmN5mWOGeMwwyPppF 7k1hhUohjs/zfE9Qtivk0tkRZnwJVF/Sn7YZ42P3uo/WkZvKINaDCCWmg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedruddvvddgjeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeg geegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 9 Nov 2023 23:37:10 -0500 (EST) Date: Fri, 10 Nov 2023 13:37:00 +0900 From: Michael Paquier To: David Steele Cc: Pg Hackers Subject: Re: Add recovery to pg_control and remove backup_label Message-ID: References: <2daf8adc-8db7-4204-a7f2-a7e94e2bfa4b@pgmasters.net> <330b8277-e755-428e-b30c-eb9ed9cafd58@pgmasters.net> <46c300b9-96a1-449c-8ecd-9003bd02cb6b@pgmasters.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="EjUR43iDrfg31goy" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --EjUR43iDrfg31goy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 07, 2023 at 05:20:27PM +0900, Michael Paquier wrote: > On Mon, Nov 06, 2023 at 05:39:02PM -0400, David Steele wrote: > I've retested today, and miss the failure. I'll let you know if I see > this again. I've done a few more dozen runs, and still nothing. I am wondering what this disturbance was. >> If we set these fields where backup_label was renamed, the logic would n= ot >> be exactly the same since pg_control won't be updated until the next time >> through the loop. Since the fields should be updated before >> UpdateControlFile() I thought it made sense to keep all the updates >> together. >>=20 >> Overall I think it is simpler, and we don't need to acquire a lock on >> ControlFile. >=20 > What you are proposing is the same as what we already do for > backupEndRequired or backupStartPoint in the control file when > initializing recovery, so objection withdrawn. >=20 >> Thomas included this change in his pg_basebackup changes so I did the sa= me. >> Maybe wait a bit before we split this out? Seems like a pretty small >> change... >=20 > Seems like a pretty good argument for refactoring that now, and let > any other patches rely on it. Would you like to send a separate > patch? The split still looks worth doing seen from here, so I am switching the patch as WoA for now. >>> Actually, grouping backupStartPointTLI and minRecoveryPointTLI should >>> reduce more the size with some alignment magic, no? >>=20 >> I thought about this, but it seemed to me that existing fields had been >> positioned to make the grouping logical rather than to optimize alignmen= t, >> e.g. minRecoveryPointTLI. Ideally that would have been placed near >> backupEndRequired (or vice versa). But if the general opinion is to >> rearrange for alignment, I'm OK with that. >=20 > I've not tested, but it looks like moving backupStartPointTLI after > backupEndPoint should shave 8 bytes, if you want to maintain a more > coherent group for the LSNs. + * backupFromStandby indicates that the backup was taken on a standby. = It is + * require to initialize recovery and set to false afterwards. s/require/required/. The term "backup recovery", that we've never used in the tree until now as far as I know. Perhaps this recovery method should just be referred as "recovery from backup"? By the way, there is another thing that this patch has forgotten: the SQL functions that display data from the control file. Shouldn't pg_control_recovery() be extended with the new fields? These fields may be less critical than the other ones related to recovery, but I suspect that showing them can become handy at least for debugging and monitoring purposes. Something in this area is that backupRecoveryRequired is the switch controlling if the fields set by the recovery initialization. Could it be actually useful to leave the other fields as they are and only reset backupRecoveryRequired before the first control file update? This would leave a trace of the backup history directly in the control file. What about pg_resetwal and RewriteControlFile()? Shouldn't these recovery fields be reset as well? git diff --check is complaining a bit. -- Michael --EjUR43iDrfg31goy Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmVNs2wACgkQnvQgOdby QH3c/A//RUzgm2dUyeEklMGQX3k74oUx0MsuwACUXdFXPH1//ybPk9t+Iqjcc7zZ wPBsgwHhufY/ZegHlwiTUYZfhrAHzHfEFN4N831qVFI4UAxaFbhHRkAFgCfgDkh3 8O0XlLe54+LxMLD5m6iDIf+WFbJb2dG2hHShskpyXXO0HpblRMZvubJfm0DaRVkv rZCuwG0/G1MhYP+FAEuvV5xNp4awTfJaOovWqcJX/t+myinEDViVluiL/sYjqai1 Qi6MvQ+lxoQyVzsSU6k+wzdLookOWQ5oH8jU37uC6oqxSh4BB7BC8xSkmc3nD9FN 6yAJdMBCcQoM+WEhsSiEi+VRAXgXWOBM02XYySqbIfQ3eE7BWwUWR4yh7i4wSYFn fRPGjA//BIxfBJst9cOELjCKzIXQGfk0wCvBapbw+ggxRUkn4xkTM8le2f69sbyx N3rRMvLhRaxGSR7toseU/jEiA9lTHwupfy2sBMlwkvRgiJID4h58+rh+p9YPYyf2 Ox6wf1bvVdKdcgZ7e6/yvQdY1l3yp6bnFxdjrCNtNCrui4Lr6dWYwo7u5BfnfDeu K8n9fuSwXRiI5Q6FSpBFG7KlepeQ/tKQxm4MPnrfRzlHXETH5VjJo1WtFoLoQf00 sV5JNovRMkl9afv54AOOKqOH+pYbz9sBucwqZYLpejIScC1iwdw= =3uLD -----END PGP SIGNATURE----- --EjUR43iDrfg31goy--