Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jA1KK-0007mj-SI for pgsql-committers@arkaria.postgresql.org; Fri, 06 Mar 2020 00:58:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jA1KJ-0005XZ-M6 for pgsql-committers@arkaria.postgresql.org; Fri, 06 Mar 2020 00:58:55 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jA1KJ-0005XS-Bi for pgsql-committers@lists.postgresql.org; Fri, 06 Mar 2020 00:58:55 +0000 Received: from mail.thelabyrinth.net ([45.56.70.56]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jA1KH-0004h5-7E for pgsql-committers@lists.postgresql.org; Fri, 06 Mar 2020 00:58:54 +0000 Received: from Davids-MacBook-Pro.local (c-73-39-102-148.hsd1.va.comcast.net [73.39.102.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dsteele) by mail.thelabyrinth.net (Postfix) with ESMTPSA id 9EE165465C; Fri, 6 Mar 2020 00:58:52 +0000 (UTC) Subject: Re: pgsql: Avoid -Wconversion warnings when using checksum_impl.h To: Michael Paquier , Magnus Hagander Cc: pgsql-committers References: <1cf30561-7dad-dc6e-9fc3-5c456948cfeb@pgmasters.net> <20200305233014.GA2501@paquier.xyz> <20200306004826.GB52814@paquier.xyz> From: David Steele Message-ID: Date: Thu, 5 Mar 2020 19:58:50 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200306004826.GB52814@paquier.xyz> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 3/5/20 7:48 PM, Michael Paquier wrote: > On Thu, Mar 05, 2020 at 04:14:20PM -0800, Magnus Hagander wrote: >> That's a pretty dangerous mistake, and moreso because we don't have a >> test around it. We should really find a way to add such a test -- just >> a hardcoded page calculation that should always return the same value >> perhaps? > > Yes.. Using pg_checksums --check on an upgraded instance which had > checksums enabled would detect that immediately, but it could be > possible also to have a SQL-callable function which takes in input a > bytea and returns the checksum. In order to make such tests reliable > with any page size, we could pass down the page size to > pg_checksum_page(), and then give the function's caller this > possibility. However I recall that we'd rather keep BLCKSZ hardcoded > in checksum_impl.h on performance grounds. Yeah, keeping BLKSZ a constant is pretty important for performance. That's one of the main reasons that we only support the default. Regards, -- -David david@pgmasters.net