Skip to content

Commit 90b9b57

Browse files
committed
[PGPRO-5378] fix unstable tests.replica.ReplicaTest.test_replica_archive_page_backup
1 parent 8846e19 commit 90b9b57

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

.travis.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ notifications:
2626

2727
# Default MODE is basic, i.e. all tests with PG_PROBACKUP_TEST_BASIC=ON
2828
env:
29-
- PG_VERSION=14 PG_BRANCH=REL_14_STABLE
30-
- PG_VERSION=13 PG_BRANCH=REL_13_STABLE
31-
- PG_VERSION=12 PG_BRANCH=REL_12_STABLE
32-
- PG_VERSION=11 PG_BRANCH=REL_11_STABLE
33-
- PG_VERSION=10 PG_BRANCH=REL_10_STABLE
34-
- PG_VERSION=9.6 PG_BRANCH=REL9_6_STABLE
29+
- PG_VERSION=14 PG_BRANCH=REL_14_STABLE MODE=archive
30+
- PG_VERSION=13 PG_BRANCH=REL_13_STABLE MODE=archive
31+
- PG_VERSION=12 PG_BRANCH=REL_12_STABLE MODE=archive
32+
- PG_VERSION=11 PG_BRANCH=REL_11_STABLE MODE=archive
33+
- PG_VERSION=10 PG_BRANCH=REL_10_STABLE MODE=archive
34+
- PG_VERSION=9.6 PG_BRANCH=REL9_6_STABLE MODE=archive
3535
- PG_VERSION=9.5 PG_BRANCH=REL9_5_STABLE
3636
# - PG_VERSION=12 PG_BRANCH=REL_12_STABLE MODE=archive
3737
# - PG_VERSION=12 PG_BRANCH=REL_12_STABLE MODE=backup
@@ -43,7 +43,7 @@ env:
4343
# - PG_VERSION=12 PG_BRANCH=REL_12_STABLE MODE=replica
4444
# - PG_VERSION=12 PG_BRANCH=REL_12_STABLE MODE=retention
4545
# - PG_VERSION=12 PG_BRANCH=REL_12_STABLE MODE=restore
46-
- PG_VERSION=15 PG_BRANCH=master
46+
- PG_VERSION=15 PG_BRANCH=master MODE=archive
4747

4848
jobs:
4949
allow_failures:

tests/replica.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,16 @@ def test_replica_archive_page_backup(self):
287287

288288
self.wait_until_replica_catch_with_master(master, replica)
289289

290+
master.pgbench_init(scale=5)
291+
# Continuous making some changes on master,
292+
# because WAL archiving on replica in idle DB in PostgreSQL is broken:
293+
# replica will not archive the previous WAL until it receives new records in the next WAL file,
294+
# this "lazy" archiving can be seen in src/backend/replication/walreceiver.c:XLogWalRcvWrite()
295+
# (see !XLByteInSeg checking and XLogArchiveNotify() calling).
296+
pgbench = master.pgbench(
297+
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
298+
options=['-T', '3', '-c', '1', '--no-vacuum'])
299+
290300
backup_id = self.backup_node(
291301
backup_dir, 'replica', replica,
292302
options=[
@@ -295,6 +305,9 @@ def test_replica_archive_page_backup(self):
295305
'--master-db=postgres',
296306
'--master-port={0}'.format(master.port)])
297307

308+
pgbench.wait()
309+
pgbench.stdout.close()
310+
298311
self.validate_pb(backup_dir, 'replica')
299312
self.assertEqual(
300313
'OK', self.show_pb(backup_dir, 'replica', backup_id)['status'])
@@ -317,8 +330,6 @@ def test_replica_archive_page_backup(self):
317330
# Change data on master, make PAGE backup from replica,
318331
# restore taken backup and check that restored data equal
319332
# to original data
320-
master.pgbench_init(scale=5)
321-
322333
pgbench = master.pgbench(
323334
options=['-T', '30', '-c', '2', '--no-vacuum'])
324335

0 commit comments

Comments
 (0)