Skip to content

Commit 7f47088

Browse files
committed
Fix query in new test to check tables are synced
Rather than looking for tablesync workers, it is more reliable to see the sync state of the tables. Per note from Amit Kapila. Discussion: https://postgr.es/m/CAA4eK1JSSD7FVwq+_rOme86jUZTQFzjsNU06hQ4-LiRt1xFmSg@mail.gmail.com
1 parent 86dba33 commit 7f47088

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/test/subscription/t/100_bugs.pl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,13 @@
141141

142142
# We cannot rely solely on wait_for_catchup() here; it isn't sufficient
143143
# when tablesync workers might still be running. So in addition to that,
144-
# we verify that no tablesync workers appear for the subscription.
144+
# verify that tables are synced.
145145
# XXX maybe this should be integrated in wait_for_catchup() itself.
146146
$node_twoways->wait_for_catchup('testsub');
147-
$node_twoways->poll_query_until(
148-
'd2',
149-
"SELECT count(*) FROM pg_stat_subscription WHERE subname = 'testsub' AND relid <> 0",
150-
"0");
147+
my $synced_query =
148+
"SELECT count(1) = 0 FROM pg_subscription_rel WHERE srsubstate NOT IN ('r', 's');";
149+
$node_twoways->poll_query_until('d2', $synced_query)
150+
or die "Timed out while waiting for subscriber to synchronize data";
151151

152152
is($node_twoways->safe_psql('d2', "SELECT count(f) FROM t"),
153153
$rows * 2, "2x$rows rows in t");

0 commit comments

Comments
 (0)