Skip to content

Commit 12b8bfb

Browse files
committed
try to speedup test_replica_archive_page_backup
1 parent 4ddf8a1 commit 12b8bfb

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/replica_test.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import threading
23
import unittest
34
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException, idx_ptrack
45
from datetime import datetime, timedelta
@@ -258,9 +259,12 @@ def test_replica_archive_page_backup(self):
258259

259260
self.wait_until_replica_catch_with_master(master, replica)
260261

262+
tm = threading.Timer(5, call_repeat, [1000, master.execute, 'select txid_current()'])
263+
tm.start()
261264
backup_id = self.backup_node(
262265
backup_dir, 'replica', replica,
263266
options=['--archive-timeout=60'])
267+
tm.join()
264268

265269
self.validate_pb(backup_dir, 'replica')
266270
self.assertEqual(
@@ -287,12 +291,12 @@ def test_replica_archive_page_backup(self):
287291
master.pgbench_init(scale=5)
288292

289293
pgbench = master.pgbench(
290-
options=['-T', '30', '-c', '2', '--no-vacuum'])
294+
options=['-T', '10', '-c', '2', '--no-vacuum'])
291295

292296
backup_id = self.backup_node(
293297
backup_dir, 'replica',
294298
replica, backup_type='page',
295-
options=['--archive-timeout=60'])
299+
options=['--archive-timeout=10'])
296300

297301
pgbench.wait()
298302

@@ -1555,6 +1559,9 @@ def test_replica_via_basebackup(self):
15551559
self.set_auto_conf(node_restored, {'port': node_restored.port})
15561560
node_restored.slow_start(replica=True)
15571561

1562+
def call_repeat(times, func, *args):
1563+
for i in range(times):
1564+
func(*args)
15581565
# TODO:
15591566
# null offset STOP LSN and latest record in previous segment is conrecord (manual only)
15601567
# archiving from promoted delayed replica

0 commit comments

Comments
 (0)