Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w6Gdr-0047oG-0a for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Mar 2026 23:31:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w6Gdp-00Cxyc-1b for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Mar 2026 23:31:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w6Gdp-00CxyT-0Y for pgsql-hackers@lists.postgresql.org; Fri, 27 Mar 2026 23:31:01 +0000 Received: from lahtoruutu.iki.fi ([185.185.170.37]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w6Gdn-00000001ZIp-0GvX for pgsql-hackers@lists.postgresql.org; Fri, 27 Mar 2026 23:31:01 +0000 Received: from [10.0.2.15] (unknown [130.41.208.2]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id 4fjH2T0qPpz49PsT; Sat, 28 Mar 2026 01:30:56 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1774654258; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=67QO8Aglton/4P4H5bzVekhXDMx/hESOTnDzqty2eHQ=; b=VyPwAlvX3vS5VSpwPd+oXzdkTiBF9GrwYDJ8/iC/jRid6xovja/sLJ2HNvTNihCsaehXyV ORDhhnNlbHJh0fLEx7eKMSJjG4Km0ejebDEfmEG2TEMVR6Hm9KEkfxZwwvi8OGavmf8QJ+ 5vTcaUpr53AhSUWbXnkQBEJOJcx25aj/xPv8GCXaV7gXzzGIkpKuJAr7H3rfax48xs99UP x+I+F89jLAn0tPzDAsyrIUpaGFWXX84U70yr084YYj8quonQwW2Pd7xIvR12MKKnsxW0Bj lPa4DGstTEGwXsMsCrvHX8GaDDnbLOASxLTRPjLjbkbdYnKwTlcrZJ+wIr2TMQ== ARC-Seal: i=1; a=rsa-sha256; d=iki.fi; s=lahtoruutu; cv=none; t=1774654258; b=THGf3tDW3X8X91t6poktxNlZXpFYqbSSVpCICc7+a9Kaz6ghBsSyCYWrxez72B97+jKBy6 DIVwIxdGGUJcb5cV3QUocVnl5M6RPuiMX5qTyQa/fuRa5uy0EqjrCFNAaGtyaEryUS6ZbF ws6zG9msyKx96Aj+2ADXYagYswswaFncjcIK6Pgo7Vo6AOaNvfogS+Fl19fluoyH9aCqd8 3v3pfaeNNU3pkCRtg+cYplAMa9OzeIQ1YbW/6vUEDjEO+L0oCVxXM4p9cMWMIibkx8uZX5 LSjEmDbA4fr5Y/EM715MxvO3P8hmB/4LQdWqYDe3G9Tv8owTsazFCJ7evAzFyg== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1774654258; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=67QO8Aglton/4P4H5bzVekhXDMx/hESOTnDzqty2eHQ=; b=n1CXjPGgmoZorSrasbz+QUEtuOwjoJKI2HJkE1I8V+BFvQ6d+Xteb7w81bR+XawYogKQbO Bj58O91DwTA92VM3TowW/1WbPvzBDA8t2fwT2oCEWHlf2hliPrOjsQKuDQWATokFbbjV7W 1Kd8pecDP3rfAz5IDZXoRu7meJP7f6cKpLkdAyT7rGJ4/hilI43H1PcIMsYTsXlQfk0wU2 mEK3jBw9j4OYqWM9Kj0fk9/R4jwY/TFMq+IWvc3EZN8N5RwTC2j418x7n7+T1EzaxA6zB6 U2kmwN31y4ooeuTFgQSVAvScO+hZoFa7GOANcud1FWl7Q8CKcflxsoYyAjTYlw== Message-ID: Date: Sat, 28 Mar 2026 01:30:56 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Changing the state of data checksums in a running cluster To: Daniel Gustafsson Cc: Tomas Vondra , Andres Freund , Bernd Helmle , Michael Paquier , Michael Banck , PostgreSQL Hackers References: <7357A519-3391-4F07-BC69-5C9C2B120792@yesql.se> <3e67160c-3676-4419-b635-1fdb80dc128e@vondra.me> <67726BDA-2F21-4D93-B01F-FA68212ED6F0@yesql.se> <9CA2495B-2D6C-4308-97EF-A12CCCAA753E@yesql.se> <477897AE-1314-4724-9694-0BABC4F4ABDA@yesql.se> <5mv5vtbqj2xm2wmevsi22smyn32jtznva3ya3daih3ixh3onex@s5fyab63xt3c> <2535E72D-5979-4F58-A2D3-2AA4AA335C20@yesql.se> <775fddbc-4dec-413d-89bb-1a8186858ee6@vondra.me> <683618b7-0946-400e-8066-97067f32d448@vondra.me> <032619A2-D466-4A12-A524-98359D96AEA6@yesql.se> <300822bd-daeb-49e5-8af7-d7ce3af65adc@iki.fi> <46d52594-fa93-4fbe-ad97-dc3127a04dd8@iki.fi> <8B86AFB8-ACBC-44FC-A1AB-A58DB541A170@yesql.se> <452D5390-4F89-4DED-9835-8E9EA2A01E19@yesql.se> Content-Language: en-US From: Heikki Linnakangas In-Reply-To: <452D5390-4F89-4DED-9835-8E9EA2A01E19@yesql.se> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 28/03/2026 00:03, Daniel Gustafsson wrote: > The attached rebase contains lots more polish, mostly renaming variable names > for clarity, tidying up comments and documentation and some smaller bits of > cleanup like moving more code out of xlog.c. > > This version runs all the tests in a normal test-run, with a few of them pared > down with larger runs gated by PG_TEST_EXTRA. I thinkt the tests are still too > expensive in the event of getting committed, but it's helpful to have them > during dev and test. Executing pgbench sometimes fails in CI but I've been > unable to reproduce that so not entirely sure what is going on there. > > Heikki, Andres and Tomas; as you have been reviewing this patchset, what do you > feel is left for considering this for commit? (Apart from figuring out the CI > test thing mentioned above which I think is a buildsystem issue.) I think 0001 > could be considered independently of 0002 and is cleanup in it's own right. +1 for committing 0001 right away. Some leftover stuff remains, related to the change that it no longer rebuilds the list of databases: > + * The DataChecksumsWorker will compile a list of all databases at the start, > + * and once all are processed will regenerate the list and start over > + * processing any new entries. Once there are no new entries on the list, > + * processing will end. The regenerated list is required since databases can > + * be created concurrently with data checksum processing, using a template > + * database which has yet to be processed. All databases MUST BE successfully > + * processed in order for data checksums to be enabled, the only exception are > + * databases which are dropped before having been processed. and here: > +/* > + * Test to remove an entry from the Databaselist to force re-processing since > + * not all databases could be processed in the first iteration of the loop. > + */ > +void > +dc_dblist(const char *name, const void *private_data, void *arg) The above talks about re-processing, but that doesn't happen anymore. I suspect the test that uses this is now obsolete or broken. > + while (true) > + { > + int processed_databases = 0; > + > + foreach_ptr(DataChecksumsWorkerDatabase, db, DatabaseList) > + { > + DataChecksumsWorkerResult result; > + DataChecksumsWorkerResultEntry *entry; > + bool found; > + > + /* > + * Check if this database has been processed already, and if so > + * whether it should be retried or skipped. > + */ > + entry = (DataChecksumsWorkerResultEntry *) hash_search(ProcessedDatabases, &db->dboid, > + HASH_FIND, NULL); > + I guess this works, but wouldn't it be simpler to remove entries from DatabaseList when they're successfully processed? > --- a/src/backend/commands/dbcommands.c > +++ b/src/backend/commands/dbcommands.c > @@ -1044,7 +1044,14 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt) > if (pg_strcasecmp(strategy, "wal_log") == 0) > dbstrategy = CREATEDB_WAL_LOG; > else if (pg_strcasecmp(strategy, "file_copy") == 0) > + { > + if (DataChecksumsInProgress()) > + ereport(ERROR, > + errcode(ERRCODE_INVALID_PARAMETER_VALUE), > + errmsg("create database strategy \"%s\" not allowed when data checksums are being enabled", > + strategy)); > dbstrategy = CREATEDB_FILE_COPY; > + } > else > ereport(ERROR, > (errcode(ERRCODE_INVALID_PARAMETER_VALUE), Is this enough? Is it possible that you start CREATE DATABASE in file_copy mode, and while it's already running but hasn't copied everything yet, you turn checksums on? - Heikki