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 1x4oW8-007QrY-1g for pgsql-hackers@arkaria.postgresql.org; Thu, 10 Sep 2026 23:49:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x4oW7-00AFni-1e for pgsql-hackers@arkaria.postgresql.org; Thu, 10 Sep 2026 23:49:19 +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 1x4oW7-00AFnT-0G for pgsql-hackers@lists.postgresql.org; Thu, 10 Sep 2026 23:49:19 +0000 Received: from mail-pj2-x10.google.com ([2607:f8b0:4864:39::10]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1x4oW4-0000000430d-3FAC for pgsql-hackers@lists.postgresql.org; Thu, 10 Sep 2026 23:49:18 +0000 Received: by mail-pj2-x10.google.com with SMTP id 98e67ed59e1d1-396ccafb751so256819a91.2 for ; Thu, 10 Sep 2026 16:49:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1789084154; x=1789688954; darn=lists.postgresql.org; h=user-agent: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=ZnXaTe8k2Ab+IpDGPu9xP15P46pk3jQBE8vY853CQfo=; b=Yh65hXWUsBNfaOUZBhfhx/zfW6QWEaN24OB08YVxhy2G2GSa7I77qyrmOBz+u0KVOx Fuy5Do9QFq6sRTp9QjQsYbn09ea1TlK07qmgHOnDRKZ07gTeeKzEs1ySAUkmA1Q45H9P z5KusL3Kr6FdcC3eFZJb/x/z5WjmbiSmFUemQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789084154; x=1789688954; h=user-agent: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=ZnXaTe8k2Ab+IpDGPu9xP15P46pk3jQBE8vY853CQfo=; b=a1YZqwHdS+L1YtMETAOC+gQRvARKzzSkUPLrFBmqQ7E7CtLT4BhmY/epUwRDF3rrZz pUrwFnCUYlpv+IzIXKOcDS9IGsDC68e3N5nnqHRiGvjSeaDwPYOTWOwls6DLdpl490Fk CKckCVi7f846RFnv6pmWWyusqoq65bvh7tHJjNwY4g7NkwQRBuirJYPKMl9zkdQsDEoV YtF0VcE/3x9pwUyj2834u597Nxssb3r3gMI+kHYqeQp+vk529Yy/GSyqpb6XxvorY9Aq tTy2RmztrggAS8S3Zm7l/1+X+mPVVH/jO1dH2QQs3LUluWb5ugqYdDGhXgmWNlXAzKfb HxoQ== X-Forwarded-Encrypted: i=1; AKwUvBzP74XYeLSTX3q0V/QFXA517+cewB5GmRQxxOT3LKS7yFyEpCh7smsR08J+y99BJEYd07tR+enHYfBTMOPN@lists.postgresql.org X-Gm-Message-State: AFuF++k7L9pExwdB5p3B0qxUfSmBv029VL+p5PdpOdm3LDe/HNPMtvGl XtBgmCtwCIqN8ZmcpiorDC4cQ3wCsIhm/N9kzDBqei44hUIetKbgcVoafS4Md4J9jQ== X-Gm-Gg: AYBFou2uEUK5LL5A75gfLSjfc2xAvbCeR0Q5PHqegHhz7+QBGAFRXOAUPYXs3Na+bcb 0YIAoAKezsDl+rwhrbpo3xh4Hw84Q8lI5o+Uq5EWcOt976Cp97obWkSiB09Xe1t3SYD0VPnq5UT Tj0EUtdoVN1qhxtDEn8lUlhocpebAFPIWJ7gXT4zlfX39ls/gFOwufFbOYRgdQ/ozNTA6yQq2OS 37VAFpAh2da1KMmMQ+ZSsR3Ll1E3fGKqOl6T2TxbflVZBjU9kCVCp+KuxU2Pp/2ItnEdFcm7mj+ EVzFP0frFSvKBvNmeGL2K+2OQJ7idetzCyi1g6z1XRXG7bcG/TX4/rDQMfjoD9+9RgaDXQj4RLe xyLyJEsx420+hRZlzcFlBZqWZ3dnOeqJEEGu8j4zGR4+35eDnQzqFeSoFjLmiVdzDCVWT+iUKBd xUO0f+MexwWpZZH3XqfbIcjFqyD7HyiBoeVGzz28JdVuX33meZjUq6sOvOP1bClfZLhNF6LLE2o dp1YIINiEc1GyWe3eBb9AZPXY1nKa0= X-Received: by 2002:a17:90b:3906:b0:398:9be8:ea6a with SMTP id 98e67ed59e1d1-39d9c364a7dmr1779089a91.23.1789084154106; Thu, 10 Sep 2026 16:49:14 -0700 (PDT) Received: from microsoft.com (c-73-15-160-255.hsd1.ca.comcast.net. [73.15.160.255]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-33ba4f06423sm1359470eec.20.2026.09.10.16.49.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Sep 2026 16:49:13 -0700 (PDT) Date: Thu, 10 Sep 2026 16:49:11 -0700 From: Noah Misch To: =?iso-8859-1?Q?=C1lvaro?= Herrera Cc: Andres Freund , Antonin Houska , pgsql-hackers@lists.postgresql.org, Mihail Nikalayeu Subject: Re: Race conditions in logical decoding Message-ID: <20260910234911.58.noahmisch@microsoft.com> References: <202603201543.t6gxppyyk66p@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/2.3.0 (2026-01-25) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Jan 19, 2026 at 05:29:25PM +0100, Antonin Houska wrote: > A stress test [1] for the REPACK patch [1] revealed data > corruption. Eventually I found out that the problem is in postgres core. In > particular, it can happen that a COMMIT record is decoded, but before the > commit could be recorded in CLOG, a snapshot that takes the commit into > account is created and even used. Visibility checks then work incorrectly > until the CLOG gets updated. On Fri, Aug 21, 2026 at 08:16:02PM +0200, Álvaro Herrera wrote: > So, what do you think of the attached? I see $SUBJECT lost open item status because released versions have the same defect. However, REPACK (CONCURRENTLY) increases the importance of $SUBJECT and other logical replication data loss causes. In v18, one can recreate the replica or run integrity checks before a cutover. REPACK (CONCURRENTLY) automates the chain: one command starts replication, waits for consistency, and deletes the last known good copy. If v19 ships without a fix for $SUBJECT, I think REPACK (CONCURRENTLY) docs need to warn about the situation. How do you see it?