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 1nirwM-0003Tu-Rm for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Apr 2022 06:11:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nirwL-00081U-MV for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Apr 2022 06:11:17 +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 1nirwK-00081L-AC for pgsql-hackers@lists.postgresql.org; Mon, 25 Apr 2022 06:11:17 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nirwD-0001HZ-AY for pgsql-hackers@postgresql.org; Mon, 25 Apr 2022 06:11:12 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 64B725C00D0; Mon, 25 Apr 2022 02:11:08 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 25 Apr 2022 02:11:08 -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=1650867068; x=1650953468; bh=ot5CHHgwDS lWxl3FFXYfE6tzPxMK5hhDjiUaS+A2VGc=; b=Pptey/NcFhlmSEgeNao9hg2bXo LBUtZaB74TrliN4HElmHCkb7O/PAkRzUvn7dt2H3PTFcCMGxCunJnIc43GNRAgzK uSbq9ohKmQKcZHu4FiZe0GxJ/mYbbSzYQgKPz1smQKgGLHlcI7VXN5D5bb5NQQ7C e1SI8A9LHUg7cBsh6yOvJOOS5fNRQM4YxsQ0PdnJrPDs9yq9FGwTtALMJRUhmuJx aCaj8Nx9hJY3C5hiiPtd07vWbvNpDRpuMkuScRje1xkU4PNFV8jQPo2ABjuaHo5b DYvCj6xXMx90mArKm9aZHVpjdAxO/L1fHiddDRRYgchjYVNNVHiIxs7S6IHw== 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=1650867068; x= 1650953468; bh=ot5CHHgwDSlWxl3FFXYfE6tzPxMK5hhDjiUaS+A2VGc=; b=u uDGol0hNyeuAJ9pU7XtIoGAAhMZrCxPbBmDZl8Q4Vl9t1dZn6P/rkExqKCX4hNyk t+w+G/1b/ff7daha4CLvT/LmQXPBStd0ANHLVjLDLMdLdwmmTdyDpuGUgvEw6mus B7kOp1zrA5hW13mPM6BJ8UkgIQVRXK8QmU/vW07lqX/RfSmw0ZhAfpgMFalmjFWA Dy/wu2zsbs1imZr0V2B9EIIqecF6Yb0skAY78dHz+R2oOpk2mKWzdeaKl+Pn1BMh mRYXuYMFNbtqCo7+bmMEyoBT1T3fYMdW17INALz867K3nX+JixTn481581RGWyz5 jZaBIYoB2/2cw1aqmPxgw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedruddtgddutdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeg geegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 25 Apr 2022 02:11:06 -0400 (EDT) Date: Mon, 25 Apr 2022 15:11:04 +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="SeZJp3N+wCSTpveK" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --SeZJp3N+wCSTpveK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Apr 23, 2022 at 01:43:36PM -0500, David Christensen wrote: > Hi Matthias, great point. Enclosed is a revised version of the patch > that adds the fork identifier to the end if it's a non-main fork. Like Alvaro, I have seen cases where this would have been really handy. So +1 from me, as well, to have more tooling like what you are proposing. Fine for me to use one file for each block with a name like what you are suggesting for each one of them.=20 + /* we accept an empty existing directory */ + if (stat(config.save_fpw_path, &st) =3D=3D 0 && S_ISDIR(st.st_mode)) + { 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. + {"raw-fpi", required_argument, NULL, 'W'}, I think that we'd better rename this option. "fpi", that is not used much in the user-facing docs, is additionally not adapted when we have an other option called -w/--fullpage. I can think of --save-fullpage. + PageSetLSN(page, record->ReadRecPtr); + /* if checksum field is non-zero then we have checksums= enabled, + * so recalculate the checksum with new LSN (yes, this = 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. + /* we will now extract the fullpage image from the XLogRecord and s= ave + * it to a calculated filename */ The format of this comment is incorrect. + The LSN of the record with this block, formatted + as %08x-%08X instead of the + conventional %X/%X due to filesystem naming + limits The last part of the sentence about %X/%X could just be removed. That could be confusing, at worse. + PageSetLSN(page, record->ReadRecPtr); Why is pd_lsn set? git diff --check complains a bit. This stuff should include some tests. With --end, the tests can be cheap. -- Michael --SeZJp3N+wCSTpveK Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmJmO3gACgkQnvQgOdby QH0ITA/9FCrzEFCQtsMOTrMX1SJ3ILIOGfx3kohOUsxpOgEUh+U6zji8IuExMJ9E 7CY7nMVtRdhqP1r8L1Kh+ZezIU1wipO8ikPUKa5chX0TkW39prZA5TvG5iFbdj1n /hqQoQvt5HAAJENbkreoRXm2Zchu86l5SZtyMbbcfH82ifd3+cAreFhlbm9H0yzR Kukg5aSI+lyzVjO1AQDMhvT7n+hyOgChBUwtX9WMbOtGByl6NILwyEKrWMn0yaoP u5IyVOgD0G2x80GwWafWa0eYO/KuTY9vldwJfdg5Mx0pPPA9OykJKWIhlW2MA3FY lNh8G69qym7fe5y66qX+Xgmmn7SbSKIMT1GwKPHcLV13WJpLH70yS3/5b0ltzHMi 0kyxxqnVk1SDjObk1fm+eSt6lrtdSyccHyNh34QXHXrln3CHJAldbrvYtc59qYGs XDqgxEKqcxBhu1Ahu3weTaSzjQ4bzoQEZfnoHTra/FYm23WBj85fmmqN7AVcfofS cisn8iiTuzHw/sCMmZnmcI4mHWOFIeBr2XAtMKpTbXCFsU86bn3l2aQRLjsbWp8i jHICjclH6cohRfwcAXvO7R7Arm433PIvR6+Qww2MtIhfDJDIp5ei3gflRasnYCyp ErH4IIFrBLQjOoxSGyw+1+JOy7SuvZsH4xVX0C1/d4qbRO4Axnc= =vHIo -----END PGP SIGNATURE----- --SeZJp3N+wCSTpveK--