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 1kUPyV-0007xo-2j for pgsql-hackers@arkaria.postgresql.org; Mon, 19 Oct 2020 07:52:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kUPyT-0006fe-Vf for pgsql-hackers@arkaria.postgresql.org; Mon, 19 Oct 2020 07:52:57 +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 1kUPyT-0006fJ-3e for pgsql-hackers@lists.postgresql.org; Mon, 19 Oct 2020 07:52:57 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kUPyR-0001fA-14 for pgsql-hackers@lists.postgresql.org; Mon, 19 Oct 2020 07:52:56 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 214525C00AF; Mon, 19 Oct 2020 03:52:53 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 19 Oct 2020 03:52:53 -0400 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=ReMBqHed3fHL9Hyk88MJgm/eems X8TQ6WW6QSfQtOIw=; b=VnYggyvcx0kW3HFkKGVXizn4qWtbopL9ujfxOLQj6cx hrXMmyXS7+/mJW/m17zOAGhvHPMFa/9QGD9kJT8dKstPupPvevPIa6cRy4WzJf9K RWSSJQB/Uwq0JZNTeXR6V8olM2MwzpD//A0T9VDvW+Xv/B9sd1hbzZbCJ2C/W6OI eb5PToPEKVf62MiCpgA7RSnzj/fhcBobzKh4xXwVNPPXRamHYpJAXhoHsMLiqR1W S7ahNwVp9AMTvom7QL5RBBzfIt5sSQBexHIKYZqk0CvD5QK4CUO49P2LBRxbPVxQ OeUaQxDKpYi47eFYNZYnZjWBwRg/yoU55u9tSXz6GRg== 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=ReMBqH ed3fHL9Hyk88MJgm/eemsX8TQ6WW6QSfQtOIw=; b=aGPz+KWZpnkM8VuyijbSER b8o/PnPjklnRWFIviF4sqJG8iBZPRgiUs78C4WJ5tkASreTBqqUQsDshdmKvfVil 0KcDCehGAkrOOk96Zi+bSQKUz6/SILrOS02hxJXxBpcEBJGxtBp82OTOE5ubGK+y /P7Uni+ZHm2AvXPEAUbxkAoxgiaFTrrqpHHQllPldF+Dc1Dumzf9mUTSnjExAJr7 5Qz3rYdZhNMEf773l/m4wvNZ4enpLYSjNlpbxQLDio9ehr/3FY0Z530uwpVY2cqQ W281OUOFQ5TWJj9aWl/s0xYCiuJY/lZwf0322A94rzoJdAdBJYH+hdjWvs/UZK4Q == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrjedtgdduvdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddt 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 DF13D328005A; Mon, 19 Oct 2020 03:52:50 -0400 (EDT) Date: Mon, 19 Oct 2020 16:52:48 +0900 From: Michael Paquier To: Julien Rouhaud Cc: Justin Pryzby , Masahiko Sawada , Robert Haas , PostgreSQL Hackers , Masahiko Sawada Subject: Re: Online checksums verification in the backend Message-ID: <20201019075248.GD9612@paquier.xyz> References: <20200916034558.GB11110@paquier.xyz> <20201001050717.GK8130@paquier.xyz> <20201019023918.GB9612@paquier.xyz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="GyRA7555PLgSTuth" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --GyRA7555PLgSTuth Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 19, 2020 at 11:16:38AM +0800, Julien Rouhaud wrote: > On Mon, Oct 19, 2020 at 10:39 AM Michael Paquier wr= ote: >> Somewhat related to the first point, NoComputedChecksum exists >> because, as the current patch is shaped, we need to report an existing >> checksum to the user even for the zero-only case. >=20 > I'm not sure that I understand your point. The current patch only > returns something to users when there's a corruption. If by > "zero-only case" you mean "page corrupted in a way that PageIsNew() > returns true while not being all zero", then it's a corrupted page and > then obviously yes it needs to be returned to users. Sorry for the confusion, this previous paragraph was confusing. I meant that the reason why NoComputedChecksum exists is that we give up on attempting to calculate the checksum if we detect that the page is new, but failed the zero-only test, and that we want the users to know about this special case by setting this expected checksum to NULL for the SRF. >> So, wouldn't it be better to just rely on PageIsVerified() >> (well it's rather-soon-to-be extended flavor) for the checksum check, >> the header sanity check and the zero-only check? My point is to keep >> a single entry point for all the page sanity checks, so as base >> backups, your patch, and the buffer manager apply the same things. >> Base backups got that partially wrong because the base backup code >> wants to keep control of the number of failures and the error >> reports. >=20 > I'm fine with it. Thanks. >> Your patch actually wishes to report a failure, but you want >> to add more context with the fork name and such. Another option we >> could use here is to add an error context so as PageIsVerified() >> reports the WARNING, but the SQL function provides more context with >> the block number and the relation involved in the check. >=20 > Also, returning actual data rather than a bunch of warnings is way > easier to process for client code. And as mentioned previously having > an API that returns a list of corrupted blocks could be useful for a > single-page recovery feature. No issues with reporting the block number and the fork type in the SRF at least of course as this is helpful to detect the position of the broken blocks. For the checksum found in the header and the one calculated (named expected in the patch), I am less sure how to put a clear definition on top of that but we could always consider that later and extend the SRF as needed. Once the user knows that both do not match, he/she knows that there is a problem. -- Michael --GyRA7555PLgSTuth Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl+NRdAACgkQnvQgOdby QH3Z2Q/+MnnErwQgd6rGaLdsUWztFLyyYqCCZHFoKlmYBou7M34EDS/kH8CjiSkg pwCD9enJkZljQF64CDw0j+036l2yC19iRWts5kTpEW76Oa904cB8HhSjW1U9vfK+ tZuEgamsC+1h6ALh62hKR2LnBZ+Hkh3MMZOkSatemUNXbz0o6iRtfVaIGLYDJFo2 UD/wWaRdM8BPRC5qkhulGSds0/qRYjT+YTGOSsZXH0IhNQfJj7+CPpBmb+7uDZdm ew02No1DhPXLUbAd1ZhaL5ILe2mU85+lpu17Z+fEOLdSs2Vor6lhurKfgmhlNYCP hqFKUWTt+QcbkypCI9KrwkyJLqni/i9FeU97lr4jDl4KqLR9YB54Px2hJn0iqdL9 MMYbpEvAMKP1ZugzwyUQOSRO2r13l6KyyyT91I5e6dM0781O+Mz75K/ROEj/ohZa BMde67vWplOr1TfqIne0q1kUZlUcpi5r5cm6RbBuVL3a2ay2E8ZBK+Fe19zEq3E/ xobft39qMb1CVDcS6I9UNTRVqAYgCAPyM67FvNP34Y5KGWMBg7zcZrL5Im6WpmFS x7Q5xz+ZNWkd1aZZxH7wW3adQHpNBOmeVJtyhSIYlQ7/qm15iruXviJbc1H4i0Nc 9ECiEMojHEZmM7msLpQQ05tiIbUYvGgol6O755d/fgkBh1SVQLI= =La61 -----END PGP SIGNATURE----- --GyRA7555PLgSTuth--