@@ -1011,6 +1011,87 @@ def test_backward_compatibility_merge_4(self):
10111011 # Clean after yourself
10121012 self .del_test_dir (module_name , fname )
10131013
1014+ # @unittest.expectedFailure
1015+ # @unittest.skip("skip")
1016+ def test_backward_compatibility_merge_5 (self ):
1017+ """
1018+ Create node, take FULL and PAGE backups with old binary,
1019+ merge them with new binary.
1020+ old binary version >= STORAGE_FORMAT_VERSION (2.4.4)
1021+ """
1022+
1023+ if self .version_to_num (self .old_probackup_version ) < self .version_to_num ('2.4.4' ):
1024+ return unittest .skip ('OLD pg_probackup binary must be == 2.4.4 for this test' )
1025+
1026+ self .assertNotEqual (
1027+ self .version_to_num (self .old_probackup_version ),
1028+ self .version_to_num (self .probackup_version ))
1029+
1030+ fname = self .id ().split ('.' )[3 ]
1031+ backup_dir = os .path .join (self .tmp_path , module_name , fname , 'backup' )
1032+ node = self .make_simple_node (
1033+ base_dir = os .path .join (module_name , fname , 'node' ),
1034+ set_replication = True ,
1035+ initdb_params = ['--data-checksums' ],
1036+ pg_options = {'autovacuum' : 'off' })
1037+
1038+ self .init_pb (backup_dir , old_binary = True )
1039+ self .add_instance (backup_dir , 'node' , node , old_binary = True )
1040+
1041+ self .set_archiving (backup_dir , 'node' , node , old_binary = True )
1042+ node .slow_start ()
1043+
1044+ node .pgbench_init (scale = 20 )
1045+
1046+ # FULL backup with OLD binary
1047+ self .backup_node (backup_dir , 'node' , node , old_binary = True )
1048+
1049+ pgbench = node .pgbench (
1050+ stdout = subprocess .PIPE ,
1051+ stderr = subprocess .STDOUT ,
1052+ options = ["-c" , "1" , "-T" , "10" , "--no-vacuum" ])
1053+ pgbench .wait ()
1054+ pgbench .stdout .close ()
1055+
1056+ # PAGE1 backup with OLD binary
1057+ self .backup_node (
1058+ backup_dir , 'node' , node , backup_type = 'page' , old_binary = True )
1059+
1060+ node .safe_psql (
1061+ 'postgres' ,
1062+ 'DELETE from pgbench_accounts' )
1063+
1064+ node .safe_psql (
1065+ 'postgres' ,
1066+ 'VACUUM pgbench_accounts' )
1067+
1068+ # PAGE2 backup with OLD binary
1069+ backup_id = self .backup_node (
1070+ backup_dir , 'node' , node , backup_type = 'page' , old_binary = True )
1071+
1072+ pgdata = self .pgdata_content (node .data_dir )
1073+
1074+ # merge chain created by old binary with new binary
1075+ output = self .merge_backup (backup_dir , "node" , backup_id )
1076+
1077+ # check that in-place is disabled
1078+ self .assertNotIn (
1079+ "WARNING: In-place merge is disabled "
1080+ "because of program versions mismatch" , output )
1081+
1082+ # restore merged backup
1083+ node_restored = self .make_simple_node (
1084+ base_dir = os .path .join (module_name , fname , 'node_restored' ))
1085+ node_restored .cleanup ()
1086+
1087+ self .restore_node (backup_dir , 'node' , node_restored )
1088+
1089+ pgdata_restored = self .pgdata_content (node_restored .data_dir )
1090+ self .compare_pgdata (pgdata , pgdata_restored )
1091+
1092+ # Clean after yourself
1093+ self .del_test_dir (module_name , fname )
1094+
10141095 # @unittest.skip("skip")
10151096 def test_page_vacuum_truncate (self ):
10161097 """
0 commit comments