Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 87a0491

Browse files
committed
Try to fix caughtup in LR tests.
1 parent eee6665 commit 87a0491

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

testgres/pubsub.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,19 @@ def catchup(self, username=None):
186186
Args:
187187
username: remote node's user name.
188188
"""
189-
query = """
190-
select pg_current_wal_lsn() - replay_lsn = 0
191-
from pg_catalog.pg_stat_replication where application_name = '{}'
192-
""".format(self.name)
193189

194190
try:
191+
pub_lsn = pub.node.execute(query="select pg_current_wal_lsn()::text from pg_catalog.pg_stat_replication",
192+
dbname=None,
193+
username=None) # yapf: disable
194+
# create dummy xact
195+
pub.node.execute(query="select txid_current()", dbname=None, username=None)
196+
query = """
197+
select {} - replay_lsn <= 0
198+
from pg_catalog.pg_stat_replication where application_name = '{}'
199+
""".format(pub_lsn, self.name)
200+
201+
195202
# wait until this LSN reaches subscriber
196203
self.pub.node.poll_query_until(
197204
query=query,

0 commit comments

Comments
 (0)