@@ -1470,13 +1470,18 @@ def test_dry_run_catchup_full(self):
1470
1470
pg_options = { 'wal_log_hints' : 'on' }
1471
1471
)
1472
1472
src_pg .slow_start ()
1473
- src_pg .safe_psql (
1474
- "postgres" ,
1475
- "CREATE TABLE ultimate_question(answer int)" )
1476
1473
1477
1474
# preparation 2: make clean shutdowned lagging behind replica
1478
1475
dst_pg = self .make_empty_node (os .path .join (module_name , self .fname , 'dst' ))
1479
1476
1477
+ src_pg .safe_psql (
1478
+ "postgres" ,
1479
+ "CREATE TABLE ultimate_question(answer int)" )
1480
+ src_pg .pgbench_init (scale = 10 )
1481
+ pgbench = src_pg .pgbench (options = ['-T' , '10' , '--no-vacuum' ])
1482
+ pgbench .wait ()
1483
+ src_pg .safe_psql ("postgres" , "INSERT INTO ultimate_question VALUES(42)" )
1484
+
1480
1485
# save the condition before dry-run
1481
1486
content_before = self .pgdata_content (dst_pg .data_dir )
1482
1487
@@ -1496,10 +1501,12 @@ def test_dry_run_catchup_full(self):
1496
1501
1497
1502
# Cleanup
1498
1503
src_pg .stop ()
1504
+ dst_pg .stop ()
1505
+ self .del_test_dir (module_name , self .fname )
1499
1506
1500
1507
def test_dry_run_catchup_ptrack (self ):
1501
1508
"""
1502
- Test dry-run option for catchup in incremental mode
1509
+ Test dry-run option for catchup in incremental ptrack mode
1503
1510
"""
1504
1511
if not self .ptrack :
1505
1512
return unittest .skip ('Skipped because ptrack support is disabled' )
@@ -1514,6 +1521,10 @@ def test_dry_run_catchup_ptrack(self):
1514
1521
src_pg .safe_psql (
1515
1522
"postgres" ,
1516
1523
"CREATE TABLE ultimate_question(answer int)" )
1524
+ src_pg .pgbench_init (scale = 10 )
1525
+ pgbench = src_pg .pgbench (options = ['-T' , '10' , '--no-vacuum' ])
1526
+ pgbench .wait ()
1527
+ src_pg .safe_psql ("postgres" , "INSERT INTO ultimate_question VALUES(42)" )
1517
1528
1518
1529
# preparation 2: make clean shutdowned lagging behind replica
1519
1530
dst_pg = self .make_empty_node (os .path .join (module_name , self .fname , 'dst' ))
@@ -1549,4 +1560,63 @@ def test_dry_run_catchup_ptrack(self):
1549
1560
1550
1561
# Cleanup
1551
1562
src_pg .stop ()
1563
+ dst_pg .stop ()
1564
+ self .del_test_dir (module_name , self .fname )
1565
+
1566
+ def test_dry_run_catchup_delta (self ):
1567
+ """
1568
+ Test dry-run option for catchup in incremental delta mode
1569
+ """
1570
+
1571
+ # preparation 1: source
1572
+ src_pg = self .make_simple_node (
1573
+ base_dir = os .path .join (module_name , self .fname , 'src' ),
1574
+ set_replication = True ,
1575
+ pg_options = { 'wal_log_hints' : 'on' }
1576
+ )
1577
+ src_pg .slow_start ()
1578
+ src_pg .safe_psql (
1579
+ "postgres" ,
1580
+ "CREATE TABLE ultimate_question(answer int)" )
1581
+ src_pg .pgbench_init (scale = 10 )
1582
+ pgbench = src_pg .pgbench (options = ['-T' , '10' , '--no-vacuum' ])
1583
+ pgbench .wait ()
1584
+ src_pg .safe_psql ("postgres" , "INSERT INTO ultimate_question VALUES(42)" )
1585
+
1586
+ # preparation 2: make clean shutdowned lagging behind replica
1587
+ dst_pg = self .make_empty_node (os .path .join (module_name , self .fname , 'dst' ))
1588
+ self .catchup_node (
1589
+ backup_mode = 'FULL' ,
1590
+ source_pgdata = src_pg .data_dir ,
1591
+ destination_node = dst_pg ,
1592
+ options = ['-d' , 'postgres' , '-p' , str (src_pg .port ), '--stream' ]
1593
+ )
1594
+ self .set_replica (src_pg , dst_pg )
1595
+ dst_options = {}
1596
+ dst_options ['port' ] = str (dst_pg .port )
1597
+ self .set_auto_conf (dst_pg , dst_options )
1598
+ dst_pg .slow_start (replica = True )
1599
+ dst_pg .stop ()
1600
+
1601
+ # save the condition before dry-run
1602
+ content_before = self .pgdata_content (dst_pg .data_dir )
1603
+
1604
+ # do incremental catchup
1605
+ self .catchup_node (
1606
+ backup_mode = 'DELTA' ,
1607
+ source_pgdata = src_pg .data_dir ,
1608
+ destination_node = dst_pg ,
1609
+ options = ['-d' , 'postgres' , '-p' , str (src_pg .port ), '--stream' , '--dry-run' ]
1610
+ )
1611
+
1612
+ # compare data dirs before and after cathup
1613
+ self .compare_pgdata (
1614
+ content_before ,
1615
+ self .pgdata_content (dst_pg .data_dir )
1616
+ )
1617
+
1618
+ # Cleanup
1619
+ src_pg .stop ()
1620
+ dst_pg .stop ()
1621
+ self .del_test_dir (module_name , self .fname )
1552
1622
0 commit comments