File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -190,7 +190,7 @@ def catchup(self, username=None):
190
190
pub_lsn = self .pub .node .execute (query = "select pg_current_wal_lsn()" ,
191
191
dbname = None ,
192
192
username = None )[0 ][0 ] # yapf: disable
193
- # create dummy xact
193
+ # create dummy xact, as LR replicates only on commit.
194
194
self .pub .node .execute (query = "select txid_current()" , dbname = None , username = None )
195
195
query = """
196
196
select '{}'::pg_lsn - replay_lsn <= 0
@@ -203,5 +203,17 @@ def catchup(self, username=None):
203
203
dbname = self .pub .dbname ,
204
204
username = username or self .pub .username ,
205
205
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 )
206
218
except Exception as e :
207
219
raise_from (CatchUpException ("Failed to catch up" , query ), e )
You can’t perform that action at this time.
0 commit comments