@@ -1470,13 +1470,18 @@ def test_dry_run_catchup_full(self):
14701470 pg_options = { 'wal_log_hints' : 'on' }
14711471 )
14721472 src_pg .slow_start ()
1473- src_pg .safe_psql (
1474- "postgres" ,
1475- "CREATE TABLE ultimate_question(answer int)" )
14761473
14771474 # preparation 2: make clean shutdowned lagging behind replica
14781475 dst_pg = self .make_empty_node (os .path .join (module_name , self .fname , 'dst' ))
14791476
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+
14801485 # save the condition before dry-run
14811486 content_before = self .pgdata_content (dst_pg .data_dir )
14821487
@@ -1496,10 +1501,12 @@ def test_dry_run_catchup_full(self):
14961501
14971502 # Cleanup
14981503 src_pg .stop ()
1504+ dst_pg .stop ()
1505+ self .del_test_dir (module_name , self .fname )
14991506
15001507 def test_dry_run_catchup_ptrack (self ):
15011508 """
1502- Test dry-run option for catchup in incremental mode
1509+ Test dry-run option for catchup in incremental ptrack mode
15031510 """
15041511 if not self .ptrack :
15051512 return unittest .skip ('Skipped because ptrack support is disabled' )
@@ -1514,6 +1521,10 @@ def test_dry_run_catchup_ptrack(self):
15141521 src_pg .safe_psql (
15151522 "postgres" ,
15161523 "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)" )
15171528
15181529 # preparation 2: make clean shutdowned lagging behind replica
15191530 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):
15491560
15501561 # Cleanup
15511562 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 )
15521622
0 commit comments