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 1wzyHM-004N9G-2G for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Aug 2026 15:14:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wzyHK-008Emo-27 for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Aug 2026 15:14:02 +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 1wzyHK-008Emg-12 for pgsql-hackers@lists.postgresql.org; Fri, 28 Aug 2026 15:14:02 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wzyHH-00000001jkz-3lWL for pgsql-hackers@lists.postgresql.org; Fri, 28 Aug 2026 15:14:02 +0000 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-482ddbc11aaso816167f8f.3 for ; Fri, 28 Aug 2026 08:13:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787930039; x=1788534839; darn=lists.postgresql.org; h=in-reply-to:content-transfer-encoding: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=bfm00qXn2D1d5MoBYzfKSDGA2hdDn5/2+El/nHLkviY=; b=EpF01KgDyJENv+fpK7WIevSpfiVHGyzcsVwUQs2GkLPLhYxkIVa+NkkBQTTQ2zmcBK OXt4+s+6uL8Lzq2ekhwLuJ2G9hGN21T/bQiQj8G0bIUI534j0LujQelex2vwNI77RcOo rVeYb20FFQeS9Ltc/32s2IlMtNu5lL3jK7r3nBC0sm8NNyfYDAznYkpbeTo472nJNfNV oZqB5e1wbMdMeHF4HnKjxa/818Uo3mefbk1qLjCaUk/2aIX6MYiCAsNe7o7mrS4y46sD HGkhaM4p34Rabl/iAMARz4R7v/JJHOxGlgaTX39GjrqzvcXmimwfmO3Htm/HV1PHNRyq Wlzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787930039; x=1788534839; h=in-reply-to:content-transfer-encoding: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=bfm00qXn2D1d5MoBYzfKSDGA2hdDn5/2+El/nHLkviY=; b=jfRCvpc3cnOMt6sUCY50ySLBrXvt3FgI3qtttvN4iqHGv86D4ep/all6AeqbOF9t6J cOUKmsxy7WydNLxjPzVGE4TEI1wVOjvAcMlOALkK+62sCVDTFGl8hvDtUk8e9yaRWzyK Z90Mqwa6NAN8lhW3FtE64iFUSIMvyhH5BCCUvBBCkhDBv9hpkLy3A09Ckghm4IfnyYl8 1TACLASXYUW/ZgTAIIl6sjNyLr3IrPqIqWE7FCmhh6+hAP5us7YEgGvyYxGU+30W0rJW OQPs7Ca04XkMymGKAnTyVPAelTpYrcrWiKQdpW9mmo+2q3ujeJTobkJ1Qm7FhM2rUbVz d2YQ== X-Gm-Message-State: AFuF++nQygW0VWwsOnAPrrdKtEBf/u6jG6tikxRofqzCw4MaUtRHURHu LEiUZotrezcK1jscWWK/uXFh2W3RUB3Vslyh8vQl55/l31fQ5Xy8TMpN X-Gm-Gg: AR+sD11N3GLx1KodHwYw8XZQM+0wfi1S1LgJNjRZpHRN08bAVSxklJ4jwEqWGRHWxC7 XvmumeR6jWbfU3jc9wO6QMufAEIS2gTcPNyOqXF1daXAvJbgNjsQedPkoFbtCVF3ac5hDEaMb2y MbuiJpOzZr9sNnVZBrCSfwOXT60i2jnxvMONmsLUm87jV6OihBCumafnkQ2JY6/ClflnE41RBv4 3xSqdDSDAH/Paww1ZQECm36ZCtItT22M8P7sA+firiSPppR4loIxf3Dt+WHKOtCZ3uMwk/DAlfT 6iz0oqZr/eptZE9pE1KUNHXUHYeIVmWzYZgVhJp+RM9+ZrPmK7oZ/Lb8lYN+Yf+s/ngDFramHJe qMKmvGzlGWVlmjf9diMz6CF7tFY5DtvycypXBJlnLYHj/ekNWbOdyjXYf0oW4zsVuYAkc1/qPfd m43eAjNoHgK9gj3R9urB/5DSXcSwrpq/QaZySPxKFGP9lZYkKcuEMB6hb+CjKz1MvYRHFsh+yPj pY48d+R1+Pi+IacMVmS9XlYIZ5ek+b8ZuegVnnyAx0aN/c6 X-Received: by 2002:a05:6000:2904:b0:482:e963:22bc with SMTP id ffacd0b85a97d-482f79a7548mr13881316f8f.6.1787930038628; Fri, 28 Aug 2026 08:13:58 -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-482fbb20526sm5248190f8f.19.2026.08.28.08.13.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2026 08:13:58 -0700 (PDT) Date: Fri, 28 Aug 2026 15:13:56 +0000 From: Bertrand Drouvot To: Zsolt Parragi Cc: pgsql-hackers@lists.postgresql.org, Daniel Gustafsson Subject: Re: Offline data checksum changes can cause incorrect checksum state on standbys Message-ID: References: <1C2BC974-44FA-487C-8A3B-8135A316A89B@yesql.se> <188A1307-1A92-45CA-9DBE-FB0962D3756E@yesql.se> <6370C439-408D-40F6-B956-55DF19FFE41C@yesql.se> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Fri, Aug 28, 2026 at 04:16:55AM -0700, Zsolt Parragi wrote: > Thanks! > > I agree that v4 is not a complete fix, and we could make it better. > The question is the balance, as every change also makes it more > complex. The main point of it is to try to minimize how invasive of a > patch it is, and making sure that offline changes work and don't > result in completely breaking a standby. > > 1: this is a valid issue, but requires somebody doing an offline > change immediately after an online change. I don't think it has to be immediate. The window lasts until the standby records a restartpoint after the XLOG2_CHECKSUMS(on) record. That may happen considerably later, depending on checkpoint replay and restartpoint creation. > The effect is that in this > print out a warning about this into the log, so this is visible, and > everything will continue working. Yes, but that leaves mismatched states and that's what we try to avoid. > 2: my understanding is that if there's a concurrent checkpoint and a > crash shortly after it, we might throw away an otherwise completed > online checksum after restarting. We properly log that checksums were > interrupted, and the state remains "off" on all nodes. Right, but the online transition had reached on before the crash and is rolled back because of 0001’s handling of the stale inprogress-on value. Even if all nodes return to off, that still looks like an incorrect state rollback introduced by 0001. > While this is > not ideal, I think this is an unlikely scenario yeah, probably. > and not the only such > issue, for example a failing DROP DATABASE foo FORCE similarly can > interrupt checksums in an unlikely case, as I reported in another > thread. I think our case is different. The checksum state has reached on, and both XLOG2_CHECKSUMS and the later REDO record carry on. It returns to off due to 0001. The sleeps in the repro only make the possible interleaving deterministic. > 3: also valid, but in my repro of this the warning fired, so it's not > silent, and things seem to work fine after the warning, and the user > can issue either an online or an offline change. The warning is useful, but I don't think it makes the resulting state correct. I think that leaves precisely the mismatched state we are trying to avoid. > 4: I couldn't construct a repro for this case, I think this can only > happen in theory in very specific engineered scenarios Yes, it's doable. While that does not lead to correctness issue, it still questions the logic here. > I agree that combining the two patches would be the best solution in > the warning direction, e.g. solving 1+3 requires the pg_control > changes from v1. Yeah, but if the resulting patch ends up being significantly more complex, that would not be reassuring either. > The reason I left that out is what I started with in > this reply: simplicity. I was mainly considering combining the two > because of v4 can emit spurious warnings in some cases Does that refer to the cases I reported for v4, or did you have additional cases in mind? > additional log state stating the correction), but even with these I am > not sure if we should make it more complex, as none of these result in > crashes/data corruption, only in state rolling back in some > engineering situations. Yeah, I understand each of these tradeoffs in isolation. What concerns me is their cumulative effect: we moved from wanting to reject mismatched states to warning about them, and we are now considering leaving some known rollback cases unhandled to keep the patch manageable. Also, I’m not sure 1 and 3 are limited to engineered situations. Even without immediate crashes, they can leave the nodes with mismatched states, which is what the patchset is trying to address. > I'll try to look into what adding the two > patches together looks like, but it most likely combines their size, > as they improve the current master code in different ways. Thanks! Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com