Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8ede692

Browse files
author
Amit Kapila
committed
Fix the race condition in the test added by7c99dc5.
After executing ALTER SUBSCRIPTION tap_sub SET PUBLICATION, we did notwait for the new walsender process to restart. As a result, an INSERTexecuted immediately after the ALTER could be decoded and skipped,considering it is not part of any subscribed publication. And, the oldapply worker could also confirm the LSN of such an INSERT. This couldcause the replication to resume from a point after the INSERT. In suchcases, we miss the expected warning about the missing publication.To fix this, ensure the walsender has restarted before continuing afterALTER SUBSCRIPTION.Reported-by: Tom Lane as per CIAuthor: vignesh C <vignesh21@gmail.com>Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>Discussion:https://postgr.es/m/1230066.1745992333@sss.pgh.pa.us
1 parentdbf42b8 commit8ede692

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

‎src/test/subscription/t/024_add_drop_pub.pl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,21 @@
9191
$node_publisher->safe_psql('postgres',"CREATE TABLE tab_3 (a int)");
9292
$node_subscriber->safe_psql('postgres',"CREATE TABLE tab_3 (a int)");
9393

94+
my$oldpid =$node_publisher->safe_psql('postgres',
95+
"SELECT pid FROM pg_stat_replication WHERE application_name = 'tap_sub' AND state = 'streaming';"
96+
);
97+
9498
# Set the subscription with a missing publication
9599
$node_subscriber->safe_psql('postgres',
96100
"ALTER SUBSCRIPTION tap_sub SET PUBLICATION tap_pub_3");
97101

102+
# Wait for the walsender to restart after altering the subscription
103+
$node_publisher->poll_query_until('postgres',
104+
"SELECT pid !=$oldpid FROM pg_stat_replication WHERE application_name = 'tap_sub' AND state = 'streaming';"
105+
)
106+
ordie
107+
"Timed out while waiting for apply worker to restart after altering the subscription";
108+
98109
my$offset =-s$node_publisher->logfile;
99110

100111
$node_publisher->safe_psql('postgres',"INSERT INTO tab_3 values(1)");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp