@@ -458,7 +458,8 @@ def test_merge_ptrack_truncate(self):
458
458
def test_merge_delta_delete (self ):
459
459
"""
460
460
Make node, create tablespace with table, take full backup,
461
- alter tablespace location, take delta backup, restore database.
461
+ alter tablespace location, take delta backup, merge full and delta,
462
+ restore database.
462
463
"""
463
464
fname = self .id ().split ('.' )[3 ]
464
465
backup_dir = os .path .join (self .tmp_path , module_name , fname , 'backup' )
@@ -542,3 +543,74 @@ def test_merge_delta_delete(self):
542
543
543
544
# Clean after yourself
544
545
self .del_test_dir (module_name , fname )
546
+
547
+ # @unittest.skip("skip")
548
+ def test_continue_failed_merge (self ):
549
+ """
550
+ Check that failed MERGE can be continued
551
+ """
552
+ fname = self .id ().split ('.' )[3 ]
553
+ backup_dir = os .path .join (self .tmp_path , module_name , fname , 'backup' )
554
+ node = self .make_simple_node (
555
+ base_dir = "{0}/{1}/node" .format (module_name , fname ),
556
+ set_replication = True , initdb_params = ['--data-checksums' ],
557
+ pg_options = {
558
+ 'wal_level' : 'replica'
559
+ }
560
+ )
561
+
562
+ self .init_pb (backup_dir )
563
+ self .add_instance (backup_dir , 'node' , node )
564
+ self .set_archiving (backup_dir , 'node' , node )
565
+ node .start ()
566
+
567
+ # FULL backup
568
+ self .backup_node (backup_dir , 'node' , node )
569
+
570
+ node .safe_psql (
571
+ "postgres" ,
572
+ "create table t_heap as select i as id,"
573
+ " md5(i::text) as text, md5(i::text)::tsvector as tsvector"
574
+ " from generate_series(0,1000) i"
575
+ )
576
+
577
+ # DELTA BACKUP
578
+ self .backup_node (
579
+ backup_dir , 'node' , node , backup_type = 'delta'
580
+ )
581
+
582
+ node .safe_psql (
583
+ "postgres" ,
584
+ "delete from t_heap"
585
+ )
586
+
587
+ node .safe_psql (
588
+ "postgres" ,
589
+ "vacuum t_heap"
590
+ )
591
+
592
+ # DELTA BACKUP
593
+ self .backup_node (
594
+ backup_dir , 'node' , node , backup_type = 'delta'
595
+ )
596
+
597
+ if self .paranoia :
598
+ pgdata = self .pgdata_content (node .data_dir )
599
+
600
+ backup_id = self .show_pb (backup_dir , "node" )[2 ]["id" ]
601
+
602
+ gdb = self .merge_backup (backup_dir , "node" , backup_id , gdb = True )
603
+
604
+ gdb .set_breakpoint ('move_file' )
605
+ gdb .run_until_break ()
606
+
607
+ if gdb .continue_execution_until_break (20 ) != 'breakpoint-hit' :
608
+ print ('Failed to hit breakpoint' )
609
+ exit (1 )
610
+
611
+ gdb ._execute ('signal SIGKILL' )
612
+
613
+ print (self .show_pb (backup_dir , as_text = True , as_json = False ))
614
+
615
+ # Try to continue failed MERGE
616
+ self .merge_backup (backup_dir , "node" , backup_id )
0 commit comments