public inbox for [email protected]  
help / color / mirror / Atom feed
From: Andrey Silitskiy <[email protected]>
To: Alexander Lakhin <[email protected]>
To: Hayato Kuroda (Fujitsu) <[email protected]>
To: Fujii Masao <[email protected]>
Cc: Andres Freund <[email protected]>
Cc: Alexander Korotkov <[email protected]>
Cc: Greg Sabino Mullane <[email protected]>
Cc: Japin Li <[email protected]>
Cc: Ronan Dunklau <[email protected]>
Cc: Vitaly Davydov <[email protected]>
Cc: Takamichi Osumi (Fujitsu) <[email protected]>
Cc: [email protected] <[email protected]>
Cc: [email protected] <[email protected]>
Cc: [email protected] <[email protected]>
Cc: [email protected] <[email protected]>
Cc: [email protected] <[email protected]>
Cc: [email protected] <[email protected]>
Cc: Kyotaro Horiguchi <[email protected]>
Cc: Peter Smith <[email protected]>
Subject: Re: Exit walsender before confirming remote flush in logical replication
Date: Wed, 3 Jun 2026 17:32:30 +0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<CAHGQGwHZnhodg7+xQZQOoRhX+emPUoPPgKZm7fOYOH3DpxxC8g@mail.gmail.com>
	<CAPpHfdvzwRo8chZax1_qscfuQJer5r8oQpYDqOURbP9uHTZrsQ@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<CAHGQGwE-vmNX_DGo5k4YiCzAwLvT0qijnSK9P1jwXm5rUS-sKw@mail.gmail.com>
	<CAHGQGwGkenMEafuytQM4u4_hT43ynLm_JvPoUZ0QsChiNhB6YA@mail.gmail.com>
	<[email protected]>
	<CAHGQGwHScfvDU742KEn9e3A6uJH3FEAnQVOKc_y--7MTyJKKQw@mail.gmail.com>
	<CAHGQGwEaqDGst+35MoB_s0TaQO+FRH8u4Dv7Z+FjCWda5RHC1g@mail.gmail.com>
	<vwlugmsogfn36jhm56zwrgd7m6xe6ircltvfh3kzt6kldvbtht@f45dgow5uhnx>
	<[email protected]>
	<OS9PR01MB1214984918640A7AC5BEE2A0AF5152@OS9PR01MB12149.jpnprd01.prod.outlook.com>
	<[email protected]>

Dear Alexander, Kuroda-san,

IIUC, the problem is that the walreceiver does not reach the main loop
before it receives a signal and this leads to the absence of the required
log on publisher. So what do think of this fix?

Added a check to the test scenario that the walreceiver on standby was
fully initialized and replication started. With this fix, I can not
reproduce failure anymore.

Regards,
Andrey Silitskiy

Attachments:

  [text/x-patch] v1-0001-Fix-walsnd_shutdown_timeout-test-case.patch (2.4K, ../[email protected]/2-v1-0001-Fix-walsnd_shutdown_timeout-test-case.patch)
  download | inline diff:
From 782c48d615abc961ab70cb33013561cedd6e6dac Mon Sep 17 00:00:00 2001
From: "a.silitskiy" <[email protected]>
Date: Wed, 3 Jun 2026 17:24:09 +0700
Subject: [PATCH v1] Fix walsnd_shutdown_timeout test case

---
 .../subscription/t/038_walsnd_shutdown_timeout.pl  | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/test/subscription/t/038_walsnd_shutdown_timeout.pl b/src/test/subscription/t/038_walsnd_shutdown_timeout.pl
index f4ed5d97852..ee5d3b77a23 100644
--- a/src/test/subscription/t/038_walsnd_shutdown_timeout.pl
+++ b/src/test/subscription/t/038_walsnd_shutdown_timeout.pl
@@ -164,16 +164,20 @@ $node_standby->append_conf(
 	hot_standby_feedback = on));
 $node_standby->start;
 
+# Wait for replication to start
+$node_publisher->safe_psql('postgres', "INSERT INTO test_tab VALUES (-1);");
+$node_standby->poll_query_until('postgres',
+ "SELECT EXISTS (SELECT 1 FROM test_tab WHERE id = -1)");
+$node_subscriber->poll_query_until('postgres',
+ "SELECT EXISTS (SELECT 1 FROM test_tab WHERE id = -1)");
+
 # Cause the logical apply worker to block on a lock by running conflicting
 # transactions on the publisher and subscriber, stalling logical replication.
-$node_publisher->wait_for_catchup('test_sub');
 $sub_session->query_safe("BEGIN; LOCK TABLE test_tab IN EXCLUSIVE MODE;");
-$node_publisher->safe_psql('postgres', "INSERT INTO test_tab VALUES (-1); ");
+$node_publisher->safe_psql('postgres', "INSERT INTO test_tab VALUES (-2); ");
 
 # Cause the standby's walreceiver to be blocked with SIGSTOP signal,
 # stalling physical replication.
-$node_standby->poll_query_until('postgres',
-	"SELECT EXISTS(SELECT 1 FROM pg_stat_wal_receiver)");
 my $receiverpid = $node_standby->safe_psql('postgres',
 	"SELECT pid FROM pg_stat_wal_receiver");
 like($receiverpid, qr/^[0-9]+$/, "have walreceiver pid $receiverpid");
@@ -184,7 +188,7 @@ $log_offset = -s $node_publisher->logfile;
 # Verify that the walsender exits due to wal_sender_shutdown_timeout
 # even when both physical and logical replication are stalled.
 # wal_sender_shutdown_timeout.
-$node_publisher->safe_psql('postgres', "INSERT INTO test_tab VALUES (-2);");
+$node_publisher->safe_psql('postgres', "INSERT INTO test_tab VALUES (-3);");
 $node_publisher->stop('fast');
 ok( $node_publisher->log_contains(
 		qr/WARNING: .* terminating walsender process due to replication shutdown timeout/,
-- 
2.34.1



view thread (66+ messages)

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: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Exit walsender before confirming remote flush in logical replication
  In-Reply-To: <[email protected]>

* 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