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 1kZske-0007JB-N2 for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Nov 2020 09:37:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kZskd-0002Jl-IN for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Nov 2020 09:37:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kZskc-0002Jd-7I for pgsql-hackers@lists.postgresql.org; Tue, 03 Nov 2020 09:37:15 +0000 Received: from [64.147.123.25] (helo=wout2-smtp.messagingengine.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kZskY-00058T-2L for pgsql-hackers@lists.postgresql.org; Tue, 03 Nov 2020 09:37:13 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id E02B063C; Tue, 3 Nov 2020 04:36:56 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Tue, 03 Nov 2020 04:36:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=gJZQl5s8xkmGii3zqM8WFQOVmIK psBMW1f9ABEfD5Es=; b=KOjRRPi5v2AKzyj5gc9F9Zt1fCzTPYUnwjWrSdmeRG1 7Q/nRphiV8Gg1n68SL3+Ov8tHL4N/Xc25plpGjyLAMDMAJgpUxmYlcQwht0QdgpA 46aGnLaOMZyxKl4vkg0TOPbh8ZK5G7DVlMJ5viBE6RJKZ5pVhcr9GM0qWrPfE+Vp jYjB1CoieXEnwBby5oxVmSJ6npAH4UoTuCFASkwLtFCbSzsXRf14m0bZJXPbgopI 2Ux/k9mGABA/NbznUN6Rt5Zc976thxLdi6I9HEaTybW+4LJtFQjMy40P/e/Exp6H 5+rZP/AaxsYLCDSFuk/xsSl2OlIJa5H39OWooypUWUQ== 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-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=gJZQl5 s8xkmGii3zqM8WFQOVmIKpsBMW1f9ABEfD5Es=; b=iWDQFV8eE5BVfwvtt9kScJ fnbNf159z2mJ+L9FYGiZ+KFLUz0xGJi7aVheUAt/19dcXcrqak9zcPoWwIXbLTwZ zl4Eo9WT1nHkzVFVAfOE4N0EF62zBeEWNbVKIW2cP0gcvOPp2NakvrGJ6iffQV+g lxPEXYkrGWpuoVCCHICXPqJEWv/X+Iwbk7D9JHZ4mHX2RurruIy41L+jCc2v3pqB GXWoMecl/gq4P/E0NkskAgsafjd+HkS7CB0yoktKRTH5bzEn5h6b7gxD2vyGnw+T QxQSrRjT9RyNbftISx5C4swEjSoDbqeKKLE5PELCRNTW4Hhnqg/KFeO/cLILJ39Q == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddtfedgtdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdlfeehmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddt vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpedvgeduuefhtdeuleettdevjeeh heeiveeuieegleetgeeljeelieeuieehgeevhfenucfkphepudduuddruddtvddrudektd drudekheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhm pehmihgthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id 80E873064610; Tue, 3 Nov 2020 04:36:53 -0500 (EST) Date: Tue, 3 Nov 2020 18:36:50 +0900 From: Michael Paquier To: Magnus Hagander Cc: Andres Freund , Robert Haas , Julien Rouhaud , Justin Pryzby , Masahiko Sawada , PostgreSQL Hackers , Masahiko Sawada Subject: Re: Online checksums verification in the backend Message-ID: <20201103093650.GA2298@paquier.xyz> References: <20201023072832.GE5180@paquier.xyz> <20201023090630.GA26347@paquier.xyz> <20201027070746.GD28445@paquier.xyz> <20201028050852.GF28445@paquier.xyz> <20201029181729.2nrub47u7yqncsv7@alap3.anarazel.de> <20201102193457.fc2hoen7ahth4bbc@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="LZvS9be/3tNcYl/X" Content-Disposition: inline In-Reply-To: X-Host-Lookup-Failed: Reverse DNS lookup failed for 64.147.123.25 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 03, 2020 at 09:31:20AM +0100, Magnus Hagander wrote: > On Mon, Nov 2, 2020 at 8:35 PM Andres Freund wrote: >> On 2020-11-02 12:35:30 -0500, Robert Haas wrote: >>> It feels really confusing to me that the user-exposed function here is >>> called pg_relation_check_pages(). How is the user supposed to >>> understand the difference between what this function does and what the >>> new verify_heapam() in amcheck does? The answer is that the latter >>> does far more extensive checks, but this isn't obvious from the SGML >>> documentation, which says only that the blocks are "verified," as if >>> an end-user can reasonably be expected to know what that means. It >>> seems likely to lead users to the belief that if this function passes, >>> they are in good shape, which is extremely far from being true. Just >>> look at what PageIsVerified() checks compared to what verify_heapam() >>> checks. The cases of verify_heapam() are much wider as they target only one AM, while this stuff should remain more general. There seems to be some overlap in terms of the basic checks done by bufmgr.c, and the fact that you may not want to be that much intrusive with the existing buffer pool as well when running the AM checks. It also seems to me that the use cases are quite different for both, the original goal of this thread is to detect physical corruptions for all AMs, while verify_heapam() looks after logical corruptions in the way heap is handled. >> Yea I had similar thoughts, it should just be called >> pg_checksum_verify_relation() or something. >=20 > +1. I mentioned that upthread, is there really a dependency with checksums here? There are two cases where we can still apply some checks on a page, without any need of checksums: - The state of the page header. - Zeroed page if pd_upper is 0. Those pages are valid, and don't have a checksum computed. So it seems to me that when it comes to relation pages, then the check of a page should answer to the question: is this page loadable in shared buffers, or not? >>> In fact, I would argue that this functionality ought to live in >>> amcheck rather than core, though there could usefully be enabling >>> functions in core. >> >> I'm not really convinced by this though. It's not really AM >> specific - works for all types of relations with storage; don't really >> object either... >=20 > Yeah, I'm not sure about that one either. Also what would happen > if/when we get checksums on things that aren't even relations? (though > maybe that goes for other parts of amcheck at some point as well?) I also thought about amcheck when looking at this thread, but it did not seem the right place as this applies to any AM able that could load stuff into the shared buffers. -- Michael --LZvS9be/3tNcYl/X Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl+hJLIACgkQnvQgOdby QH0a6hAAiqMELsOM3tKqzMycxAl3ktXFyUBqNfr4KzHKfpBd1SQ95xhiSeVniGAA xV3QTswQ2C0GJlZ/QlkX2B1Y60vN338ajz2sjCKnCtZL0oxHMgEwtavqM9+f9KiI B2W9oWHgyd+7x6z7krxp9KHC7MK0zeNS42dSCnDH6t8oCOH3ibi0weQ78ByC0EGF oEto028sXxf862YvhAYq8GIY1ngQhAJmJqTR2qNLDbU4Ing7mwTBzdCjLMcVZjaa jgI2WG4vBAvxp7EXOFySpgzMKSwKJWNI0xb6wiVxmXdJpmiTTj3PHrjh7Ppdmh9K 9OKwkLvfDGJFLGXgAdarSwwh1GquJb1UTjL5bglKiuOaeAUXgjBTvN+Eiqjc5cbE adLS79Hodptl11LfSyd8TtwLDMQkJMfSVqa7bX0x/z9SVGi+m9li+FCKqlzbZpH0 K1/QEZ/9EoQsXFZd2DpTLKW/8M2JPRCC4KLX3/9lMnDYDuvEHwqk4Z6WogtvOJUM xAWmwJ3CEXewmf2Jq4lwsNO6d9Ig1LibaUEYcs/GeuSKMzaaHvMqOyyKkSQ1LVGp F4nF1QgtSpTlpuQN4+yBWbGPGj7JNNakOE6nO4Tc19aZiNh4az9G35GXGbaWTJni oCSOHDu3xZsnJ6wwu27YPOywWWFebEGybKBF563bHsN0eO8b0LQ= =DT5Q -----END PGP SIGNATURE----- --LZvS9be/3tNcYl/X--