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 1vlY5T-000ZCM-1M for pgsql-hackers@arkaria.postgresql.org; Thu, 29 Jan 2026 19:53:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vlY4R-000fnI-0M for pgsql-hackers@arkaria.postgresql.org; Thu, 29 Jan 2026 19:52:51 +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 1vlY4Q-000fn9-2V for pgsql-hackers@lists.postgresql.org; Thu, 29 Jan 2026 19:52:51 +0000 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vlY4P-000000004Az-0MSs for pgsql-hackers@lists.postgresql.org; Thu, 29 Jan 2026 19:52:51 +0000 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-43246af170aso908347f8f.0 for ; Thu, 29 Jan 2026 11:52:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1769716368; x=1770321168; darn=lists.postgresql.org; h=message-id:date:content-transfer-encoding:mime-version:comments :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=w+KOfMaTptn3Hox/Jnv9Qrs2+yF5sfRTFscYMh1qP0I=; b=EzG/FhkLU2p+UbOFV8XjP/Bh07PEGIUbNlZG7jtedr1OXwzpiu3HBPAzRQ10UvmtdZ tjpkSm6mUJPbL/AvE8f1RiKB3Ojwg3xgXyclKL5N1iXe13lcNr4iHEQJX4E1Pz5VYT+G kPj3a3uGRKG7nm3CMyMkkexazERxGjCvDKx5U20a4qCsVm0L2RN8umZw0Ap50zMELFqq 7Ac+xnuWSVpeY3L5DenwRqq4RnezjUYkgcAxKNUUWaWS7MKu7oFNY+f1CH8014BxFD3i U2YwliEyasGpZ9hFmEhVqeJ+B3lODjRkNYHfXd3rfUkAT4NvympyjO5qSJhSyV7C9LEd R6Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769716368; x=1770321168; h=message-id:date:content-transfer-encoding:mime-version:comments :references:in-reply-to:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=w+KOfMaTptn3Hox/Jnv9Qrs2+yF5sfRTFscYMh1qP0I=; b=JlartG6tU6/0qzMVXgTh89+wV7PfDEdNSj0fT0L6IY1jppK9seCoDJY/wSpMQ1Bjnv 21Ou3gqGby38z8Lx+CQ/pm1I7/25Zl6epIzmoXL8eY5AybL5XRIH4NS7d8xPyOx2dUhm 3BdNuTVFT/BEAlQo5C+rfNr7NsabhA/qQmwnYz4KPSq6/4HD1ES6wx+pJAR1uxHAu0Gl YnPrMbxm2uEK1F6LIgRszbGnx7aK5Y1me7zv1bdMOcp3/5FBxktsNfjxHL6IA5zMY9fu JpeXWSYQ3Zc1moXTlgGkd34gi1lm5+n8P7xosKzp56KFUqwhvnZ6YumRaPhzaocqLsVF 9mWA== X-Gm-Message-State: AOJu0YzlTo/puW6rOg0Agfxt9X9Dnb4lHqxDFS4e2zSOe1WaOUIQIEjF 4CMjaJoQycxsNbIrLb8HgIp/QPRG2uF1dC7aLmLdTtg2MCwdC/sHoje+QYS938otWz8= X-Gm-Gg: AZuq6aJf2EjsjBmQ/0JQklDj2LjfvGRToVYRThRQXLIuXle3Z8jYAqTWXIj8sm05MVA 7r/7VA4O6U0Ib9aLarOHb7BTH4o7atMdUNt5n+uetGsTvRhHB3smziLCoh/3/3eGgFuTTNRtZPY 9vL3ezL7Iag6X2+rb7oD6qxk+ILW5ch16f96nR6sYBtcQa75k1ORQAPU/9HygZYETp5sv2YFj7j etDePo2de50UDGOanpkWpJfRysdG/OOAicyNZ1crmOCu27DCtcwcHGQjWmOaeGkjI4t3L+Ve3d7 ukI45bNzNuQoVukc2EUBpRn5bi+Vd15XHGauzsMxCrDVWyFzu2VEqtdUZKkZeCN8ifppigxN3nQ DQP/8XZ0hxsRfTTsmqGFy0E/tHq5kRzZClmrYwr8vHBpCIg+xU779uOJ9+zityXlvV34PQNLyK2 zXJeZR9TPacjaH4n5GDiKLNYTZ X-Received: by 2002:a05:6000:24c5:b0:435:aaba:b904 with SMTP id ffacd0b85a97d-435ea06715fmr5640813f8f.8.1769716367870; Thu, 29 Jan 2026 11:52:47 -0800 (PST) Received: from localhost (109-81-168-246.rct.o2.cz. [109.81.168.246]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435e1323034sm16298080f8f.35.2026.01.29.11.52.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jan 2026 11:52:47 -0800 (PST) From: Antonin Houska To: alvherre@kurilemu.de cc: pgsql-hackers@lists.postgresql.org Subject: Re: Race conditions in logical decoding In-reply-to: <202601282119.cosfxnhvtqpo@alvherre.pgsql> References: <202601282119.cosfxnhvtqpo@alvherre.pgsql> Comments: In-reply-to =?us-ascii?Q?=3D=3Futf-8=3FQ=3F=3DC3=3D81lvaro=3F=3D?= Herrera message dated "Wed, 28 Jan 2026 22:48:45 +0100." X-Mailer: MH-E 8.6+git; nmh 1.8; GNU Emacs 28.3 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 29 Jan 2026 20:52:47 +0100 Message-ID: <44674.1769716367@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk =C3=81lvaro Herrera wrote: > On 2026-Jan-23, Antonin Houska wrote: >=20 > > > This way you wait repeatedly for one transaction until it is marked > > > committed; and once it does, you don't test it again. > >=20 > > Sure, that's much beter. Thanks. >=20 > Actually, I wonder if it would make sense to sleep just once after > testing all the transactions for whether they are marked committed (not > once per transaction); and after sleeping, we only test again those that > were not marked committed in the previous iteration. I think you would > end up doing less tests overall. Something like this I suppose that TransactionIdDidCommit() returns false pretty rarely, so one iteration is sufficient in almost all cases. Besides that, I preferred simp= ler code because it's easier to test (It's not trivial to have debugger reach t= he conditions.) However it's just my preference - no real objections to your approach. --=20 Antonin Houska Web: https://www.cybertec-postgresql.com