Skip to content

Commit 76ea566

Browse files
committed
Well, that was even trickier.
1 parent ef89ed5 commit 76ea566

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

testgres/pubsub.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def catchup(self, username=None):
190190
pub_lsn = self.pub.node.execute(query="select pg_current_wal_lsn()",
191191
dbname=None,
192192
username=None)[0][0] # yapf: disable
193-
# create dummy xact
193+
# create dummy xact, as LR replicates only on commit.
194194
self.pub.node.execute(query="select txid_current()", dbname=None, username=None)
195195
query = """
196196
select '{}'::pg_lsn - replay_lsn <= 0
@@ -203,5 +203,17 @@ def catchup(self, username=None):
203203
dbname=self.pub.dbname,
204204
username=username or self.pub.username,
205205
max_attempts=LOGICAL_REPL_MAX_CATCHUP_ATTEMPTS)
206+
207+
# Now, wait until there are no tablesync workers: probably
208+
# replay_lsn above was sent with changes of new tables just skipped;
209+
# they will be eaten by tablesync workers.
210+
query = """
211+
select count(*) = 0 from pg_subscription_rel where srsubstate != 'r'
212+
"""
213+
self.node.poll_query_until(
214+
query=query,
215+
dbname=self.pub.dbname,
216+
username=username or self.pub.username,
217+
max_attempts=LOGICAL_REPL_MAX_CATCHUP_ATTEMPTS)
206218
except Exception as e:
207219
raise_from(CatchUpException("Failed to catch up", query), e)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy