1
1
import os
2
+ import threading
2
3
import unittest
3
4
from .helpers .ptrack_helpers import ProbackupTest ,ProbackupException ,idx_ptrack
4
5
from datetime import datetime ,timedelta
@@ -258,9 +259,12 @@ def test_replica_archive_page_backup(self):
258
259
259
260
self .wait_until_replica_catch_with_master (master ,replica )
260
261
262
+ tm = threading .Timer (5 ,call_repeat , [1000 ,master .execute ,'select txid_current()' ])
263
+ tm .start ()
261
264
backup_id = self .backup_node (
262
265
backup_dir ,'replica' ,replica ,
263
266
options = ['--archive-timeout=60' ])
267
+ tm .join ()
264
268
265
269
self .validate_pb (backup_dir ,'replica' )
266
270
self .assertEqual (
@@ -287,12 +291,12 @@ def test_replica_archive_page_backup(self):
287
291
master .pgbench_init (scale = 5 )
288
292
289
293
pgbench = master .pgbench (
290
- options = ['-T' ,'30 ' ,'-c' ,'2' ,'--no-vacuum' ])
294
+ options = ['-T' ,'10 ' ,'-c' ,'2' ,'--no-vacuum' ])
291
295
292
296
backup_id = self .backup_node (
293
297
backup_dir ,'replica' ,
294
298
replica ,backup_type = 'page' ,
295
- options = ['--archive-timeout=60 ' ])
299
+ options = ['--archive-timeout=10 ' ])
296
300
297
301
pgbench .wait ()
298
302
@@ -1555,6 +1559,9 @@ def test_replica_via_basebackup(self):
1555
1559
self .set_auto_conf (node_restored , {'port' :node_restored .port })
1556
1560
node_restored .slow_start (replica = True )
1557
1561
1562
+ def call_repeat (times ,func ,* args ):
1563
+ for i in range (times ):
1564
+ func (* args )
1558
1565
# TODO:
1559
1566
# null offset STOP LSN and latest record in previous segment is conrecord (manual only)
1560
1567
# archiving from promoted delayed replica