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 1x0uEF-004sRh-2z for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Aug 2026 05:06:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x0uEE-00FdjQ-28 for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Aug 2026 05:06:42 +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 1x0uEE-00FdjG-19 for pgsql-hackers@lists.postgresql.org; Mon, 31 Aug 2026 05:06:42 +0000 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1x0uEB-000000028T6-3iSn for pgsql-hackers@lists.postgresql.org; Mon, 31 Aug 2026 05:06:42 +0000 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-48436668d20so544276f8f.3 for ; Sun, 30 Aug 2026 22:06:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788152798; x=1788757598; darn=lists.postgresql.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=4j7CAnX3xWXAG//EkqLqx5A55TYqmvFdXVAiU2ZKq1g=; b=MxSdt/DoTtl2qJZtW5Y9NNvJHFmkbAgdfpV7xiWyXmO/1763tOebz6hZScw/24CWFo d5LHw/bc+AqJMQFys3DOqTuQzGd87uUUjRMPjScSo8+H7JZ36g3t8/nUNyWcBTD7vg2G craODUPoelYf0tdOis3sqJ16pZq0hB/HO+7iUfNUE2QnEZf2rQ3JhhGsDDEdq8XH8MI8 MPTBtln8Hbpi+oAd2/WOpYy99K2S/AoCAe6zSHeELHX4MLTm8syZZ9UEsYq2heKPflhr YaM0PnMFxzZTeXfLljSZL83lm1BbguWw/ID/gzh5c7fhbG62IMPYPfs4wGviABerPxRR 4HyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788152798; x=1788757598; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=4j7CAnX3xWXAG//EkqLqx5A55TYqmvFdXVAiU2ZKq1g=; b=gJkfrY/hKD0dAqygZs6SfHza4I0aC8Hey2S4m6sDyjddPgusCCxOwbiecTUg2TSKjD FywvAFlygJ+OrxwjogLDDijfTrxxGIxDFghL+Yr2PO7f59DQqkej94sjV4flQ4B7pN/U XjqNGSe3F5OWFRUd3BfFIpgbpCwC1yX7U37adoe7prYD3GLRWM3eyT+x4O47Ti1ChhAc 1yLxP6H97aq5hPISHdRErN3wWoTeMRvkBNN8w654dkQ7rjgrs6h84HHvi/K0hOLhbsWp /7Ewomr+V4nAPODJGsNo57TYd2k4BuvSV5YPsL7mqfQBWgMUg2we4xhs8/mqE6lcXlmx lBUQ== X-Gm-Message-State: AFuF++lgd2o3Jxp6DgTEtpMoqoBfphzhZg/If1StsL8R5UbdvPVlpIw7 tu34mVxgNCjo6Oe+LxAOBIqfnY/m7USRZ3XM+dI/oSreUkhEpRAveDLouEBl6Q== X-Gm-Gg: AR+sD11NQ6kwT2+nFY7VUFJeeWdFJwxI73cy8i/qrz6ZNU+HQVFWHu5VKJ/yc9zPORP t48EFsXRuhXObQRNUhQ3ceLMaXilceJ1Ba1FrVAmdinGYDjonIE95bimWrLGq/uvB8f4yD1Iz1d 0im4PxOZUY/DlfqXsq7cTlIpWXY/3cWRfbjj1DP7dd/mq3EvD/6rec+HzFs6GTMjpyrEsrCBt// 9kuEg8iGEp8FI4Rwn/Kvp/Ffuak/E4v7ZYIGQAdbaHIRfR9+kExwU6gy/i143xMUwITY/HiTz3V V7jUf0EcZVcr5Tx695ewvHxdZN5reNsLEkrfO89eWvvrlOpNtLK+KD1qTMdXuvAg2SaRJZUnAV9 6cgFDztDTXFEoVhvsHSn2BM9quz9TdP5ET2YHoq6IcVjptFdrDQ3cnwaFxO/N643MfodFpdo2vC 6niwEDeU89gc4cpIKHFJCelxzBVXCoDeygoCT7Y3R3QgIbeSIvsYe8PRK9iqS9sSMGrtV72y6Uf DWR1+MJRfq/sjtttpEG1CN//lDkdNozU7LFsYrlIPCQVGDliB91bM7pteQ= X-Received: by 2002:a05:600d:8498:20b0:499:dbae:86be with SMTP id 5b1f17b1804b1-49b91c4de9bmr272226505e9.14.1788152798081; Sun, 30 Aug 2026 22:06:38 -0700 (PDT) Received: from bdtpg (ec2-15-237-197-144.eu-west-3.compute.amazonaws.com. [15.237.197.144]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-482fbb20793sm19665728f8f.17.2026.08.30.22.06.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Aug 2026 22:06:37 -0700 (PDT) Date: Mon, 31 Aug 2026 05:06:36 +0000 From: Bertrand Drouvot To: Zsolt Parragi Cc: pgsql-hackers@lists.postgresql.org Subject: Re: Offline data checksum changes can cause incorrect checksum state on standbys Message-ID: References: <188A1307-1A92-45CA-9DBE-FB0962D3756E@yesql.se> <6370C439-408D-40F6-B956-55DF19FFE41C@yesql.se> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Sat, Aug 29, 2026 at 10:36:14PM +0100, Zsolt Parragi wrote: > > Thanks! I don't see the patch attached. Would you mind sharing it? > > Sorry, I forgot to attach it to the previous email. Thanks! === 1 The v5-0001 commit message says: " The documented procedure for offline changes in a replication setup becomes the lockstep one: stop all nodes, run pg_checksums on each of them, then restart. " I did some more testing and realized that stopping both nodes is not sufficient to prevent a mismatch in all cases. For example, start a primary and standby with checksums off, with the standby's latest replayed checksum transition at L0: 1. Stop the standby. 2. Enable and then disable checksums online on the primary. This writes: L1: inprogress-on L2: on L3: inprogress-off L4: off 3. Stop the primary. 4. Run pg_checksums --enable on both stopped nodes. At this point: primary: on, watermark L4 standby: on, watermark L0 The standby has not seen L1-L4. When it restarts, each record has an LSN greater than L0 and is therefore applied. The final XLOG2_CHECKSUMS(off) changes the standby back to off, while the primary remains on. We get a mismatch despite both nodes being stopped when pg_checksums ran. The mismatch remains silent until a later primary checkpoint carrying on is replayed. FWIW, v1 has the same issue. Fixing this would probably require recording additional ordering information for offline changes, adding even more complexity to v5. Another option would be to document that the standby must be fully caught up before both nodes are stopped for the offline operation. > > Do you see the control version change as a concern? > > Yes, it is another non-trivial change in an already complex patch, > really close to RC1. It's also not an area where we could easily > implement bug fixes in a minor version, if we discover something > later. Yeah, and I think the case above reinforces that concern. === 2 + printf(_("Data checksum watermark: %X/%08X\n"), + LSN_FORMAT_ARGS(ControlFile->data_checksum_lsn)); + printf(_("Data checksum state is node-local: %s\n"), + (ControlFile->data_checksum_is_local ? _("yes") : _("no"))); That produces pg_upgrade --check against a running source cluster with checksums enabled to fail with: " old cluster does not use data checksums but the new one does " Matching "Data page checksum version:" specifically should fix it. That makes me realize that we don't have tests for pg_upgrade --check against a running cluster: I'll open a dedicated thread and submit a patch to add those new tests. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com