agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Amit Kapila <akapila@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix race condition in subscription TAP test 023_twophase_stream.
Date: Thu, 06 Aug 2026 06:17:47 +0000
Message-ID: <E1wrrQJ-00000000Ofg-0WAP@gemulon.postgresql.org> (raw)

Fix race condition in subscription TAP test 023_twophase_stream.

Buildfarm member olingo intermittently failed this test, timing out while
waiting for the subscriber log to report an ERROR because
max_prepared_transactions is zero there. The test captured the log offset
only after issuing the publisher's
BEGIN/INSERT/PREPARE TRANSACTION/COMMIT PREPARED sequence.

Since streaming is enabled, the subscriber can receive and apply the
transaction, and log the expected ERROR, before that publisher SQL command
even returns, i.e. before the test captures the offset. The subsequent
wait_for_log() calls then searched only from a point after the message had
already been written, and timed out waiting for it.

Fix by moving the offset capture to before the publisher's transaction is
issued, ensuring it always precedes the point where the ERROR can appear
in the subscriber log.

Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Zhijie Hou <houzj.fnst@fujitsu.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Backpatch-through: 16, where test was introduced
Discussion: https://postgr.es/m/c43753d8-5265-4f77-83ff-9b1167276ec5@gmail.com

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/b37f14875a284b7bf3c5ec2e3691aa5d8bf8e736

Modified Files
--------------
src/test/subscription/t/023_twophase_stream.pl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)



view thread (9+ messages)  latest in thread

Message-ID: <E1wrrQJ-00000000Ofg-0WAP@gemulon.postgresql.org>
Permalink:  ../E1wrrQJ-00000000Ofg-0WAP@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wrrQJ-00000000Ofg-0WAP@gemulon.postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: akapila@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix race condition in subscription TAP test 023_twophase_stream.
  In-Reply-To: <E1wrrQJ-00000000Ofg-0WAP@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox