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 1qm3H4-005Qa5-O5 for pgsql-hackers@arkaria.postgresql.org; Fri, 29 Sep 2023 02:30:38 +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 1qm3H2-000w17-7X for pgsql-hackers@arkaria.postgresql.org; Fri, 29 Sep 2023 02:30:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qm3H1-000w0r-TI for pgsql-hackers@lists.postgresql.org; Fri, 29 Sep 2023 02:30:35 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qm3Gv-008CAY-0z for pgsql-hackers@postgresql.org; Fri, 29 Sep 2023 02:30:35 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id D2CFA5C0C72; Thu, 28 Sep 2023 22:30:27 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 28 Sep 2023 22:30:27 -0400 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=fm2; t=1695954627; x=1696041027; bh=dz tQzwB0ZRtwbXfzR+9kvMHgoiaaexseXrEmeIYToOQ=; b=PpnnEVbjntLngUBqgw /4O9xjFVmPa9okf5czICP+57fSFPfQUlLFJXWdgNCLf0L2lm4wljIsDfdKig1HEw CCrZtkOACWY2AS88x4ZKiV2VpCuf+FufiUrAVoLqEjAdtEGtscp4VBXdKO3GaZSu jxYH0dRSl4Ym3VyuiTjb2gvgBoFuAZA1thKbXZQsGQGWBS12W+Xw7BO5yYEz4gby MixEWeph0MzenzuwLw9oewvyL8SlsjxWdOoPL6yzfkx1WePPiZKdQmea30DB2j2b FwOkiszdNHcn+gBQZ00oNlM2yOa4QeCUkv7KAL9u7NXBBZOPJ600JecTEKfms1Di YwuQ== 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=fm2; t=1695954627; x=1696041027; bh=dztQzwB0ZRtwb XfzR+9kvMHgoiaaexseXrEmeIYToOQ=; b=HcsLbK0itf0yj2XMQYVOt9EU8CA7N BekxZQXyxIhxIaa2bFKBFYwl6rXYN8xssny6a/yIdVELvRYHZ8CZ+0mT2r0HuQlD N5cvSfhgWGFu88QyISQRaBhWVLTOoHk9zIe0KpGIAoqDl3FxS4iNLtR4Kn7lBD57 gO9PpWRdyG7PhS2XrfE/l3WGlOS4ZuwGMB3a0ra7cUi2ycFaazC0iEfnd8iHMfvP z9/LTg6k6xRTgKcfHUUyw2NojjO4a2Vxj+thGsVkxFFHJwXFDiFPSz/3Fw5B5UGp aSQ+Ya6EaZr0JWyWO/O1LFYnLqiCQT1CAmnFLmqTj7gu900l+0vAegKqw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrtddugdeiudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculdejtddmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreertddt vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpeetleeifedufffhhfdtteelgeeg geffhfekueevteeigfduudevudetgfegiedvjeenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 28 Sep 2023 22:30:25 -0400 (EDT) Date: Fri, 29 Sep 2023 11:30:21 +0900 From: Michael Paquier To: David Steele Cc: Pg Hackers Subject: Re: The danger of deleting backup_label Message-ID: References: <1330cb48-4e47-03ca-f2fb-b144b49514d8@pgmasters.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="KCSWMwjVzCvxOGbk" Content-Disposition: inline In-Reply-To: <1330cb48-4e47-03ca-f2fb-b144b49514d8@pgmasters.net> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --KCSWMwjVzCvxOGbk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Sep 28, 2023 at 05:14:22PM -0400, David Steele wrote: > While reading through [1] I saw there were two instances where backup_lab= el > was removed to achieve a "successful" restore. This might work on trivial > test restores but is an invitation to (silent) disaster in a production > environment where the checkpoint stored in backup_label is almost certain= to > be earlier than the one stored in pg_control. Definitely successful. > Recovery worked perfectly as long as backup_label was present and failed > hard when it was not: >=20 > LOG: invalid primary checkpoint record > PANIC: could not locate a valid checkpoint record >=20 > It's not a very good message, but at least the foot gun has been removed.= We > could use this as a special value to give a better message, and maybe use > something a bit more unique like 0xFFFFFFFFFADEFADE (or whatever) as the > value. Why not just InvalidXLogRecPtr? > This is all easy enough for pg_basebackup to do, but will certainly be > non-trivial for most backup software to implement. In [2] we have discuss= ed > perhaps returning pg_control from pg_backup_stop() for the backup software > to save, or it could become part of the backup_label (encoded as hex or > base64, presumably). I prefer the latter as this means less work for the > backup software (except for the need to exclude pg_control from the backu= p). >=20 > I don't have a patch for this yet because I did not test this idea using > pg_basebackup, but I'll be happy to work up a patch if there is interest. If the contents of the control file are tweaked before sending it through a BASE_BACKUP, it would cover more than just pg_basebackup. Switching the way the control file is sent with new contents in sendFileWithContent() rather than sendFile() would be one way, for instance.. -- Michael --KCSWMwjVzCvxOGbk Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmUWNr0ACgkQnvQgOdby QH18QA//TFWABdPVqId86fOe3lLqshCwndQ5UFkFkS1u615lHiKeDDRU2dx+uxmE E1Hz9/JkGD/DAd+KT9foqV+xPtGMYyqogYzDoyk/pmhS4ixnONLflXvUUOSzExo2 lfmYGMZkuDs32NWmQRFLMYaR2DVZZEzDV7KV1zcw1sIjuJgRo2oT3HenuGRj1NvT iCyYTUH75RTZM5B70fS4jrMwMxbuppqH3htiyD51YH/9SUAXehulzCQaxUeKjlPv 1Uqck9mNmGvkCwzxj6+9FkS3SPuJXTIrYAjtRSitfYCHAplyfE8R2Dxe2c7npQgi n53ECbPeZcP/CIS8BXwS52cAWfenCOce2wY3vyc1VKkbAO9uSYxJn+TrPGuVPMiK SAjTLrmeJtKqGhXZKF4kgxuJQqHTUDUtzOVVE8qFQ384FC4pIB23DCtw+ZTz5kPs UTR3DCD3rJYOzLkpl8hsd/wvD9k853VE5M77N0MLLdFT1XGHAeyGCSXO0cgmzNE8 H8GKdeQH+FyokATv24MIetnWN1qIuEoflLRDIgppgYnPOua6BaZ6CVdWGa6YRFJZ aIgPCnJRPwgTzMzQ29Gfys6hB/0U49TeMEInfZr/Bqakfx6vCTE7vGp37c+ziKQq Com3d2fKRqWafuRFYqBO4/hD7qTga8TUsPV4yuR8MLoL2unxHs4= =9R2H -----END PGP SIGNATURE----- --KCSWMwjVzCvxOGbk--