Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1njBL3-00051q-O6 for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Apr 2022 02:54:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1njBL1-0006gc-II for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Apr 2022 02:54:03 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1njBL1-0006ep-8T for pgsql-hackers@lists.postgresql.org; Tue, 26 Apr 2022 02:54:03 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1njBKy-0002TB-VB for pgsql-hackers@postgresql.org; Tue, 26 Apr 2022 02:54:02 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id EB46B3200947; Mon, 25 Apr 2022 22:53:58 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 25 Apr 2022 22:53:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc: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=fm1; t=1650941638; x=1651028038; bh=79M/1/Q1xN F/saXPk8+Io6Tsg+TvP9hmHEWmw4mpSdI=; b=m/scc0dTw48PJrIfB+Pfsp5CFn 0aSIWr4dZzvSC4W2KLh4/567LQl/ZPSQMxRaDNUeFedwSglfilCa2V0tIkZr6Fym yMsVigk1q+J+7L50LkgbAz1KaONopVfJus5zqPt/Y4gJI5l2rHaCtmYh/Oh9R6cy 1RpmxWSh/4851eqiTmXfEt25nk5spl3sbLMDTWb5lXE/WNwBGZR7IZ1JmS1FWHqu 51RKfid+wRvW2he+7Puyr47J9UawdyWYf1Pdt6CTxQm5qa7XmwXAI8Ei7omDKn57 gLL84/DB00eF3hz8IHgtZNcMlzzEhE5Nfbraxq2hubodZQ5EHuY7S3PdhApA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date: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=fm1; t=1650941638; x= 1651028038; bh=79M/1/Q1xNF/saXPk8+Io6Tsg+TvP9hmHEWmw4mpSdI=; b=q D47N1/9YO8iVW18+85kHXQ6r6PgdtV5yAsQ2jKAWFsRol4kflMYlX2l2N4tAvpWK P9vznYI/zWXmhTPe+gG7TMaAYj4HopGT+IX5emhgJU0/PrLvC0SK0mjIvS9bi/sJ YUcWuR+MNzJ5QYPT9HpWjeh+1kCMSMEZXCtug4qhci1EqqPDayQ+j9aqA9irtC3q cfqsKLKSqczqfvsD8bLW3tEz+QCeYMdO5b6DM1YWnlmblN7dCD/qfl9VHHE1I9CU qKmnRV7NDTilcm28eugqACv1R9tAbPXqHDkkVtBsrTPznnVipDyreJfe5LA+9Tox XSO1lQs6Yo3P5Jz1JRELg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedruddvgdeiudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculdejtddmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreertddt vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpeetleeifedufffhhfdtteelgeeg geffhfekueevteeigfduudevudetgfegiedvjeenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 25 Apr 2022 22:53:56 -0400 (EDT) Date: Tue, 26 Apr 2022 11:53:54 +0900 From: Michael Paquier To: David Christensen Cc: Matthias van de Meent , PostgreSQL-development Subject: Re: [PATCH] Teach pg_waldump to extract FPIs from the WAL Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="BrHDe2OHu8jn8djw" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --BrHDe2OHu8jn8djw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Apr 25, 2022 at 10:11:10AM -0500, David Christensen wrote: > On Mon, Apr 25, 2022 at 1:11 AM Michael Paquier wro= te: >> I don't think that there is any need to rely on a new logic if there >> is already some code in place able to do the same work. See >> verify_dir_is_empty_or_create() in pg_basebackup.c, as one example, >> that relies on pg_check_dir(). I think that you'd better rely at >> least on what pgcheckdir.c offers. >=20 > Yeah, though I am tending towards what another user had suggested and > just accepting an existing directory rather than requiring it to be > empty, so thinking I might just skip this one. (Will review the file > you've pointed out to see if there is a relevant function though.) OK. FWIW, pg_check_dir() is used in initdb and pg_basebackup because these care about the behavior to use when specifying a target path. You could reuse it, but use a different policy depending on its returned result for the needs of what you see fit in this case. >> + PageSetLSN(page, record->ReadRecPtr); >> + /* if checksum field is non-zero then we have checks= ums enabled, >> + * so recalculate the checksum with new LSN (yes, th= is is a hack) >> + */ >> Yeah, that looks like a hack, but putting in place a page on a cluster >> that has checksums enabled would be more annoying with >> zero_damaged_pages enabled if we don't do that, so that's fine by me >> as-is. Perhaps you should mention that FPWs don't have their >> pd_checksum updated when written. >=20 > Can make a mention; you thinking just a comment in the code is > sufficient, or want there to be user-visible docs as well? I was thinking about a comment, at least. > This was to make the page as extracted equivalent to the effect of > applying the WAL record block on replay (the LSN and checksum both); > since recovery calls this function to mark the LSN where the page came > from this is why I did this as well. (I do see perhaps a case for > --raw output that doesn't munge the page whatsoever, just made > comparisons easier.) Hm. Okay. The argument goes both ways, I guess, depending on what we want to do with those raw pages. Still you should not need pd_lsn if the point is to be able to stick the pages back in place to attempt to get back as much data as possible when loading it back to the shared buffers? -- Michael --BrHDe2OHu8jn8djw Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmJnXsIACgkQnvQgOdby QH0tUQ/9HYewq+Fzbr16YjUpNBibaCfR0JFg+TaTC1YTawk7K3IYb5l4rGYJ9WNP C9nlxmx3xOJ9p4VjNMPkCgnaZvCSdRb6X70p8yDFO91nkvhGMm6GtG075bv41ccY EF5KUn2TgYczfWZnG2jmv7Q9aUXiMGZhbgp359NyrDtLTIKMsKFmxeksgOiITaWj 0h/CIIXxDzcO8xzuz+6v1uwN1DC2O22PvFlknm3bHhkNMKJbRDQyksgFTEt5wcVR 5TSARV8o2VHGfFxQ5zHTsPbmfIoI95EtfByFJO9bqe4DuAW06avFl7EaQlwlfUMY +NmEyDqRJyf9R38T5u2FhiFZ3fCJI/FQyhie74lRFlP7oe5W2wrRVy7AyuuzOGQ+ I6uaFrkfzlDtu+aQvXQcQcDeEMhJdPac5Jacg3MYA+XlLSjwNp28XoV21b1k3Eb/ dykonezhsbN+udrktwY0lW8BmerMCnGAA84QpTwlYO8tDZFP2N9uKkRkHg48VeP3 dwjloiT7CNaExGqysVfsHQOMVefglXyOiT5bioQPo2zhqmLppvLraN9SuzSksEOP RhuBMv2fg10FuuqEqL4pPhnOy+bvwpdlb4IZMH2piSs4CF1sToBFf2K7oUpowBZb YjrMdZ6EWuv4wWN+/7w7SrFhZJghDs68a4BqaX7SeiSMZjTQ144= =cSXy -----END PGP SIGNATURE----- --BrHDe2OHu8jn8djw--