From d9421d4ae4522a2dde7b2ec9f08fe9be432c2793 Mon Sep 17 00:00:00 2001
From: "houzj.fnst" <houzj.fnst@cn.fujitsu.com>
Date: Thu, 23 Jun 2022 18:59:17 +0800
Subject: [PATCH] Fix instability in subscription regression test.

028_row_filter.pl neglected to wait for the subscriber's initial
synchronization to happen after refreshing the publication on subscriber
side.
---
 src/test/subscription/t/028_row_filter.pl | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/test/subscription/t/028_row_filter.pl b/src/test/subscription/t/028_row_filter.pl
index 0dc0a6d..183bed4 100644
--- a/src/test/subscription/t/028_row_filter.pl
+++ b/src/test/subscription/t/028_row_filter.pl
@@ -620,6 +620,11 @@ $node_subscriber->safe_psql('postgres',
 	"TRUNCATE TABLE tab_rowfilter_partitioned");
 $node_subscriber->safe_psql('postgres',
 	"ALTER SUBSCRIPTION tap_sub REFRESH PUBLICATION WITH (copy_data = true)");
+
+# wait for initial table synchronization to finish
+$node_subscriber->poll_query_until('postgres', $synced_query)
+  or die "Timed out while waiting for subscriber to synchronize data";
+
 $node_publisher->safe_psql('postgres',
 	"INSERT INTO tab_rowfilter_partitioned (a, b) VALUES(4000, 400),(4001, 401),(4002, 402)"
 );
-- 
2.7.2.windows.1

