Skip to content

Commit df33561

Browse files
author
Amit Kapila
committed
Fix cfbot failure caused by commit 228c370.
Ensure the test waits for the apply worker to exit after disabling the subscription. This is necessary to safely enable the retain_dead_tuples option. Also added a similar wait in another part of the test to prevent unintended apply worker activity that could lead to test failures post-subscription disable. Reported by Michael Paquier as per cfbot. Author: Zhijie Hou <houzj.fnst@fujitsu.com> Discussion: https://postgr.es/m/aIGLgfRJIBwExoPj@paquier.xyz
1 parent 086b9a3 commit df33561

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/test/subscription/t/035_conflicts.pl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,11 @@
228228
# Disable the subscription
229229
$node_A->psql('postgres', "ALTER SUBSCRIPTION $subname_AB DISABLE;");
230230

231+
# Wait for the apply worker to stop
232+
$node_A->poll_query_until('postgres',
233+
"SELECT count(*) = 0 FROM pg_stat_activity WHERE backend_type = 'logical replication apply worker'"
234+
);
235+
231236
# Enable retain_dead_tuples for disabled subscription
232237
($cmdret, $stdout, $stderr) = $node_A->psql('postgres',
233238
"ALTER SUBSCRIPTION $subname_AB SET (retain_dead_tuples = true);");
@@ -278,6 +283,11 @@
278283
# Disable the logical replication from node B to node A
279284
$node_A->safe_psql('postgres', "ALTER SUBSCRIPTION $subname_AB DISABLE");
280285

286+
# Wait for the apply worker to stop
287+
$node_A->poll_query_until('postgres',
288+
"SELECT count(*) = 0 FROM pg_stat_activity WHERE backend_type = 'logical replication apply worker'"
289+
);
290+
281291
$node_B->safe_psql('postgres', "UPDATE tab SET b = 3 WHERE a = 1;");
282292
$node_A->safe_psql('postgres', "DELETE FROM tab WHERE a = 1;");
283293

0 commit comments

Comments
 (0)