@@ -218,6 +218,12 @@ def test_ptrack_cluster_on_btree_replica(self):
218
218
master .safe_psql ('postgres' , 'vacuum t_heap' )
219
219
master .safe_psql ('postgres' , 'checkpoint' )
220
220
221
+ self .backup_node (
222
+ backup_dir , 'replica' , replica , options = [
223
+ '-j10' , '--stream' , '--master-host=localhost' ,
224
+ '--master-db=postgres' , '--master-port={0}' .format (
225
+ master .port )])
226
+
221
227
for i in idx_ptrack :
222
228
# get size of heap and indexes. size calculated in pages
223
229
idx_ptrack [i ]['old_size' ] = self .get_fork_size (replica , i )
@@ -227,16 +233,19 @@ def test_ptrack_cluster_on_btree_replica(self):
227
233
idx_ptrack [i ]['old_pages' ] = self .get_md5_per_page_for_fork (
228
234
idx_ptrack [i ]['path' ], idx_ptrack [i ]['old_size' ])
229
235
230
- self .backup_node (
231
- backup_dir , 'replica' , replica , options = [
232
- '-j10' , '--stream' , '--master-host=localhost' ,
233
- '--master-db=postgres' , '--master-port={0}' .format (
234
- master .port )])
235
-
236
236
master .safe_psql ('postgres' , 'delete from t_heap where id%2 = 1' )
237
237
master .safe_psql ('postgres' , 'cluster t_heap using t_btree' )
238
238
master .safe_psql ('postgres' , 'checkpoint' )
239
239
240
+ # Sync master and replica
241
+ lsn = master .safe_psql (
242
+ 'postgres' , 'SELECT pg_catalog.pg_current_wal_lsn()' ).rstrip ()
243
+ replica .poll_query_until (
244
+ "postgres" ,
245
+ "SELECT '{0}'::pg_lsn <= pg_last_wal_replay_lsn()" .format (
246
+ lsn ))
247
+ replica .safe_psql ('postgres' , 'checkpoint' )
248
+
240
249
# CHECK PTRACK SANITY
241
250
success = True
242
251
for i in idx_ptrack :
@@ -322,6 +331,12 @@ def test_ptrack_cluster_on_gist_replica(self):
322
331
lsn ))
323
332
replica .safe_psql ('postgres' , 'checkpoint' )
324
333
334
+ self .backup_node (
335
+ backup_dir , 'replica' , replica , options = [
336
+ '-j10' , '--stream' , '--master-host=localhost' ,
337
+ '--master-db=postgres' , '--master-port={0}' .format (
338
+ master .port )])
339
+
325
340
for i in idx_ptrack :
326
341
# get size of heap and indexes. size calculated in pages
327
342
idx_ptrack [i ]['old_size' ] = self .get_fork_size (replica , i )
@@ -331,12 +346,6 @@ def test_ptrack_cluster_on_gist_replica(self):
331
346
idx_ptrack [i ]['old_pages' ] = self .get_md5_per_page_for_fork (
332
347
idx_ptrack [i ]['path' ], idx_ptrack [i ]['old_size' ])
333
348
334
- self .backup_node (
335
- backup_dir , 'replica' , replica , options = [
336
- '-j10' , '--stream' , '--master-host=localhost' ,
337
- '--master-db=postgres' , '--master-port={0}' .format (
338
- master .port )])
339
-
340
349
master .safe_psql ('postgres' , 'delete from t_heap where id%2 = 1' )
341
350
master .safe_psql ('postgres' , 'cluster t_heap using t_gist' )
342
351
master .safe_psql ('postgres' , 'checkpoint' )
0 commit comments