@@ -4436,3 +4436,78 @@ def test_corrupt_ptrack_map(self):
44364436
44374437# Clean after yourself
44384438self .del_test_dir (module_name ,fname )
4439+
4440+ # @unittest.skip("skip")
4441+ def test_horizon_lsn_ptrack (self ):
4442+ """
4443+ https://github.com/postgrespro/pg_probackup/pull/386
4444+ """
4445+
4446+ if self .pg_config_version < self .version_to_num ('11.0' ):
4447+ return unittest .skip ("You need PostgreSQL >= 11 for this test" )
4448+
4449+ self .assertLessEqual (
4450+ self .version_to_num (self .old_probackup_version ),
4451+ self .version_to_num ('2.4.15' ),
4452+ 'You need pg_probackup old_binary =< 2.4.15 for this test' )
4453+
4454+ fname = self .id ().split ('.' )[3 ]
4455+ backup_dir = os .path .join (self .tmp_path ,module_name ,fname ,'backup' )
4456+ node = self .make_simple_node (
4457+ base_dir = os .path .join (module_name ,fname ,'node' ),
4458+ set_replication = True ,
4459+ ptrack_enable = True ,
4460+ initdb_params = ['--data-checksums' ])
4461+
4462+ self .init_pb (backup_dir )
4463+ self .add_instance (backup_dir ,'node' ,node )
4464+ node .slow_start ()
4465+
4466+ if node .major_version >= 11 :
4467+ node .safe_psql (
4468+ "postgres" ,
4469+ "CREATE EXTENSION ptrack" )
4470+
4471+ # TODO: ptrack version must be 2.1
4472+ ptrack_version = node .safe_psql (
4473+ "postgres" ,
4474+ "SELECT extversion "
4475+ "FROM pg_catalog.pg_extension WHERE extname = 'ptrack'" ).decode ('utf-8' ).rstrip ()
4476+
4477+ self .assertEqual (
4478+ ptrack_version ,
4479+ "2.1" ,
4480+ "You need ptrack 2.1 for this test" )
4481+
4482+ # set map_size to a minimal value
4483+ self .set_auto_conf (node , {'ptrack.map_size' :'1' })
4484+ node .restart ()
4485+
4486+ node .pgbench_init (scale = 100 )
4487+
4488+ # FULL backup
4489+ full_id = self .backup_node (backup_dir ,'node' ,node ,options = ['--stream' ],old_binary = True )
4490+
4491+ # enable archiving so the WAL size to do interfere with data bytes comparison later
4492+ self .set_archiving (backup_dir ,'node' ,node )
4493+ node .restart ()
4494+
4495+ # change data
4496+ pgbench = node .pgbench (options = ['-T' ,'10' ,'-c' ,'1' ,'--no-vacuum' ])
4497+ pgbench .wait ()
4498+
4499+ # DELTA is exemplar
4500+ delta_id = self .backup_node (
4501+ backup_dir ,'node' ,node ,backup_type = 'delta' )
4502+ delta_bytes = self .show_pb (backup_dir ,'node' ,backup_id = delta_id )["data-bytes" ]
4503+ self .delete_pb (backup_dir ,'node' ,backup_id = delta_id )
4504+
4505+ # PTRACK with current binary
4506+ ptrack_id = self .backup_node (backup_dir ,'node' ,node ,backup_type = 'ptrack' )
4507+ ptrack_bytes = self .show_pb (backup_dir ,'node' ,backup_id = ptrack_id )["data-bytes" ]
4508+
4509+ # make sure that backup size is exactly the same
4510+ self .assertEqual (delta_bytes ,ptrack_bytes )
4511+
4512+ # Clean after yourself
4513+ self .del_test_dir (module_name ,fname )