@@ -21,14 +21,18 @@ def test_replica_switchover(self):
21
21
over the course of several switchovers
22
22
https://www.postgresql.org/message-id/54b059d4-2b48-13a4-6f43-95a087c92367%40postgrespro.ru
23
23
"""
24
-
25
24
fname = self .id ().split ('.' )[3 ]
26
25
backup_dir = os .path .join (self .tmp_path , module_name , fname , 'backup' )
27
26
node1 = self .make_simple_node (
28
27
base_dir = os .path .join (module_name , fname , 'node1' ),
29
28
set_replication = True ,
30
29
initdb_params = ['--data-checksums' ])
31
30
31
+ if self .get_version (node1 ) < self .version_to_num ('9.6.0' ):
32
+ self .del_test_dir (module_name , fname )
33
+ return unittest .skip (
34
+ 'Skipped because backup from replica is not supported in PG 9.5' )
35
+
32
36
self .init_pb (backup_dir )
33
37
self .add_instance (backup_dir , 'node1' , node1 )
34
38
@@ -287,6 +291,16 @@ def test_replica_archive_page_backup(self):
287
291
288
292
self .wait_until_replica_catch_with_master (master , replica )
289
293
294
+ master .pgbench_init (scale = 5 )
295
+ # Continuous making some changes on master,
296
+ # because WAL archiving on replica in idle DB in PostgreSQL is broken:
297
+ # replica will not archive the previous WAL until it receives new records in the next WAL file,
298
+ # this "lazy" archiving can be seen in src/backend/replication/walreceiver.c:XLogWalRcvWrite()
299
+ # (see !XLByteInSeg checking and XLogArchiveNotify() calling).
300
+ pgbench = master .pgbench (
301
+ stdout = subprocess .PIPE , stderr = subprocess .STDOUT ,
302
+ options = ['-T' , '3' , '-c' , '1' , '--no-vacuum' ])
303
+
290
304
backup_id = self .backup_node (
291
305
backup_dir , 'replica' , replica ,
292
306
options = [
@@ -295,6 +309,9 @@ def test_replica_archive_page_backup(self):
295
309
'--master-db=postgres' ,
296
310
'--master-port={0}' .format (master .port )])
297
311
312
+ pgbench .wait ()
313
+ pgbench .stdout .close ()
314
+
298
315
self .validate_pb (backup_dir , 'replica' )
299
316
self .assertEqual (
300
317
'OK' , self .show_pb (backup_dir , 'replica' , backup_id )['status' ])
@@ -317,8 +334,6 @@ def test_replica_archive_page_backup(self):
317
334
# Change data on master, make PAGE backup from replica,
318
335
# restore taken backup and check that restored data equal
319
336
# to original data
320
- master .pgbench_init (scale = 5 )
321
-
322
337
pgbench = master .pgbench (
323
338
options = ['-T' , '30' , '-c' , '2' , '--no-vacuum' ])
324
339
@@ -535,6 +550,11 @@ def test_replica_promote(self):
535
550
start backup from replica, during backup promote replica
536
551
check that backup is failed
537
552
"""
553
+ if not self .gdb :
554
+ self .skipTest (
555
+ "Specify PGPROBACKUP_GDB and build without "
556
+ "optimizations for run this test"
557
+ )
538
558
fname = self .id ().split ('.' )[3 ]
539
559
backup_dir = os .path .join (self .tmp_path , module_name , fname , 'backup' )
540
560
master = self .make_simple_node (
@@ -706,6 +726,7 @@ def test_replica_stop_lsn_null_offset(self):
706
726
output )
707
727
708
728
# Clean after yourself
729
+ gdb_checkpointer .kill ()
709
730
self .del_test_dir (module_name , fname )
710
731
711
732
# @unittest.skip("skip")
@@ -1085,6 +1106,7 @@ def test_replica_toast(self):
1085
1106
self .compare_pgdata (pgdata , pgdata_restored )
1086
1107
1087
1108
# Clean after yourself
1109
+ gdb_checkpointer .kill ()
1088
1110
self .del_test_dir (module_name , fname )
1089
1111
1090
1112
# @unittest.skip("skip")
@@ -1313,6 +1335,11 @@ def test_replica_promote_archive_delta(self):
1313
1335
'checkpoint_timeout' : '30s' ,
1314
1336
'archive_timeout' : '30s' })
1315
1337
1338
+ if self .get_version (node1 ) < self .version_to_num ('9.6.0' ):
1339
+ self .del_test_dir (module_name , fname )
1340
+ return unittest .skip (
1341
+ 'Skipped because backup from replica is not supported in PG 9.5' )
1342
+
1316
1343
self .init_pb (backup_dir )
1317
1344
self .add_instance (backup_dir , 'node' , node1 )
1318
1345
self .set_config (
@@ -1433,6 +1460,11 @@ def test_replica_promote_archive_page(self):
1433
1460
'checkpoint_timeout' : '30s' ,
1434
1461
'archive_timeout' : '30s' })
1435
1462
1463
+ if self .get_version (node1 ) < self .version_to_num ('9.6.0' ):
1464
+ self .del_test_dir (module_name , fname )
1465
+ return unittest .skip (
1466
+ 'Skipped because backup from replica is not supported in PG 9.5' )
1467
+
1436
1468
self .init_pb (backup_dir )
1437
1469
self .add_instance (backup_dir , 'node' , node1 )
1438
1470
self .set_archiving (backup_dir , 'node' , node1 )
@@ -1550,6 +1582,11 @@ def test_parent_choosing(self):
1550
1582
set_replication = True ,
1551
1583
initdb_params = ['--data-checksums' ])
1552
1584
1585
+ if self .get_version (master ) < self .version_to_num ('9.6.0' ):
1586
+ self .del_test_dir (module_name , fname )
1587
+ return unittest .skip (
1588
+ 'Skipped because backup from replica is not supported in PG 9.5' )
1589
+
1553
1590
self .init_pb (backup_dir )
1554
1591
self .add_instance (backup_dir , 'master' , master )
1555
1592
0 commit comments