@@ -2709,3 +2709,56 @@ def test_issue_132_1(self):
2709
2709
2710
2710
# Clean after yourself
2711
2711
self .del_test_dir (module_name , fname )
2712
+
2713
+ # @unittest.skip("skip")
2714
+ def test_parent_backup_made_by_newer_version (self ):
2715
+ """incremental backup with parent made by newer version"""
2716
+ fname = self .id ().split ('.' )[3 ]
2717
+ node = self .make_simple_node (
2718
+ base_dir = os .path .join (module_name , fname , 'node' ),
2719
+ initdb_params = ['--data-checksums' ])
2720
+
2721
+ backup_dir = os .path .join (self .tmp_path , module_name , fname , 'backup' )
2722
+ self .init_pb (backup_dir )
2723
+ self .add_instance (backup_dir , 'node' , node )
2724
+ self .set_archiving (backup_dir , 'node' , node )
2725
+ node .slow_start ()
2726
+
2727
+ backup_id = self .backup_node (backup_dir , 'node' , node )
2728
+
2729
+ control_file = os .path .join (
2730
+ backup_dir , "backups" , "node" , backup_id ,
2731
+ "backup.control" )
2732
+
2733
+ version = self .probackup_version
2734
+ fake_new_version = str (int (version .split ('.' )[0 ]) + 1 ) + '.0.0'
2735
+
2736
+ with open (control_file , 'r' ) as f :
2737
+ data = f .read ();
2738
+
2739
+ data = data .replace (version , fake_new_version )
2740
+
2741
+ with open (control_file , 'w' ) as f :
2742
+ f .write (data );
2743
+
2744
+ try :
2745
+ self .backup_node (backup_dir , 'node' , node , backup_type = "page" )
2746
+ # we should die here because exception is what we expect to happen
2747
+ self .assertEqual (
2748
+ 1 , 0 ,
2749
+ "Expecting Error because incremental backup should not be possible "
2750
+ "if parent made by newer version.\n Output: {0} \n CMD: {1}" .format (
2751
+ repr (self .output ), self .cmd ))
2752
+ except ProbackupException as e :
2753
+ self .assertIn (
2754
+ "pg_probackup do not guarantee to be forward compatible. "
2755
+ "Please upgrade pg_probackup binary." ,
2756
+ e .message ,
2757
+ "\n Unexpected Error Message: {0}\n CMD: {1}" .format (
2758
+ repr (e .message ), self .cmd ))
2759
+
2760
+ self .assertEqual (
2761
+ self .show_pb (backup_dir , 'node' )[1 ]['status' ], "ERROR" )
2762
+
2763
+ # Clean after yourself
2764
+ self .del_test_dir (module_name , fname )
0 commit comments