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 1kNqob-0004lt-KE for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Oct 2020 05:07:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kNqoa-00030P-82 for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Oct 2020 05:07:36 +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 1kNqoa-00030E-0v for pgsql-hackers@lists.postgresql.org; Thu, 01 Oct 2020 05:07:36 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kNqoT-0001gy-GK for pgsql-hackers@lists.postgresql.org; Thu, 01 Oct 2020 05:07:34 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 5FD67B2C; Thu, 1 Oct 2020 01:07:27 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 01 Oct 2020 01:07:27 -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=fm2; bh=i5/YmOxD672+viaYNM0N9DkGXQf jkQR/GqA8GgmNE24=; b=LSY8D0gSOPWkwkMxFZzSeVOAWM55NV2MJDwdyzzvd/h SFx8E3j2s3+0MzXZJM++FuULF5Dsw9e2t7zC2z1kpGD/3E3mJhqY6afX/cpVfW2q f6k8PUi8SLeW401EakVn0nokbYplF4cw8/Sw2M9Mfig+P9QFDOjPwT/oLyzv4aYO X02CMRKKNWBkuNUqZmrlNdWmCe0UuF8Vwm5UoD0H6UVVZNBH/3McbuoY5m9rB9N7 crn+0vURD7JisBm/W7F5czSQh/HwnXlf2oILrBRFbZM9W1PUSKADWkIM/rgNpSVz tXkDRl9m29jCwqPW4eQWB4tDBpELJYY/DOMUZ+Jf67A== 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=fm3; bh=i5/YmO xD672+viaYNM0N9DkGXQfjkQR/GqA8GgmNE24=; b=OUBiA6AKVr+Dvi9Whu1Ope rUT5PFfGJRKKEUZF+BRaVlXi4rV2v9J7ESyMSg2OenRiy2zt9bawPW9pjKbZDCL2 lDvv6n6hSeaRycNVqFWLyzgbR5gACRx3dee0NJHy28up8S8H27Vge0/FrV3dLtlK rhgyWzTB1G3a4BzXg4a0fhJ+ocD7wj7pNEYYOpMYoWUpu9PExQwRA3/1OhbxotP6 N9ZY+ZAz5wnYrUpvw9nur7Xo6MyizwokxDOHyJnVJVfxST9TeqWQtmvBdwblAlb4 B4pFBUYy2sSWJPV/pBnSWqS9JrcDut6WXmlLEWSJIwqMxjZFsib0uxMzN2PrpyQg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrfeefgdelgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculdejtddmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredttddv necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepvdegudeuhfdtueeltedtveejheeh ieevueeigeelteegleejleeiueeiheegvefhnecukfhppeduuddurddutddvrddukedtrd dukeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhep mhhitghhrggvlhesphgrqhhuihgvrhdrgiihii 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 BFC623280059; Thu, 1 Oct 2020 01:07:24 -0400 (EDT) Date: Thu, 1 Oct 2020 14:07:17 +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: <20201001050717.GK8130@paquier.xyz> References: <20200907085038.GA19261@paquier.xyz> <20200909092524.GC57691@nol> <20200909134130.GA29325@nol> <20200910074723.GA91494@nol> <20200910180610.GA62228@nol> <20200911073412.GJ2743@paquier.xyz> <20200916034558.GB11110@paquier.xyz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="pN9MePJoZbRKbUk1" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --pN9MePJoZbRKbUk1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 25, 2020 at 06:11:47PM +0800, Julien Rouhaud wrote: > Thanks a lot for the tests! I'm not surprised that forcing the lock > will slow down the pg_check_relation() execution, but I'm a bit > surprised that holding the buffer mapping lock longer in a workload > that has a lot of evictions actually makes things faster. Do you have > any idea why that's the case? That's still a bit unclear to me, but I have not spent much time thinking about this particular point either. > I'm assuming that you prefer to remove both the optimization and the > throttling part? I'll do that with the next version unless there's > objections. Yeah, any tests I have done tends to show that. It would be good to also check some perf profiles here, at least for the process running the relation check in a loop. > I agree that putting the code nearby ReadBuffer_common() would be a > good idea. However, that means that I can't move all the code to > contrib/ I'm wondering what you'd like to see going there. I can see > some values in also having the SQL functions available in core rather > than contrib, e.g. if you need to quickly check a relation on a > standby, so without requiring to create the extension on the primary > node first. Good point. This could make the user experience worse. > Then, I'm a bit worried about adding this code in ReadBuffer_common. > What this code does is quite different, and I'm afraid that it'll make > ReadBuffer_common more complex than needed, which is maybe not a good > idea for something as critical as this function. >=20 > What do you think? Yeah, I have been looking at ReadBuffer_common() and it is true that it is complicated enough so we may not really need an extra mode or more options, for a final logic that is actually different than what a buffer read does: we just want to know if a page has a valid checksum or not. An idea that I got here would be to add a new, separate function to do the page check directly in bufmgr.c, but that's what you mean. Now only the prefetch routine and ReadBuffer_common use partition locks, but getting that done in the same file looks like a good compromise to me. It would be also possible to keep the BLCKSZ buffer used to check the page directly in this routine, so as any caller willing to do a check don't need to worry about any allocation. -- Michael --pN9MePJoZbRKbUk1 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl91ZAUACgkQnvQgOdby QH2xhw//QMkNdJsMRCE2ODREZRMRC8m+O0nmfq7wgRXM39j4NTGKBpPL6QjuLh3N I9mmwUC2vUzUnklu2PANjiwzWBoZH7zwy3myEs5oUQwqhWFYqG+avTYSpmywdS/+ qkHIj121GK5pE35ZyociSe03bx6eHDdHCu6DFh4pvDi+kcJt8ZEXBl4Qqgl9reGb Hrd7NjUlshVfaDVZiS5F+basSoKy7orXn0Sko/dtX8+pT735mOV/qFak6HvZx6BM lDgy/1YDTzV5KNHG3bBsfLn6LDtEkK7iZZ1Ib/kl5bOxoDQls6OvHY6fnOPduubf /5tjsoktvtua7m+ZNODQj7vZb4G5D9z+978jEnggjxrF0vmZYpXFo+r/d0uup9JO IBNKMMUXjkLNM+HVGGQV8U9tx/KAXY9PxZZpCeUGzS3tmlVzjzWMnIE0gTR/kMs5 vFH0huofMH0TnaxLlDl9j5SqvmY0xuf73eYBnVHl6QhuznjPLTu/i+XHR0d0fL2Q AoXQ9xanKZwJY2IvgtFlj5z7zEy195E9jyNghaUWEwEDzMnW5KVsXG9fhU76sTrm DLzWmWQORYXtbWusAJNkrnjBYzTiXIh6lICiIVDr2HCYwJpRHjnEuSpKjJenDb31 OpzWrj3FwVdsous1lRLhSQHge3IrT1fMTYJspngqRIzKLeUa1HM= =XWBx -----END PGP SIGNATURE----- --pN9MePJoZbRKbUk1--