@@ -532,64 +532,67 @@ def generate_keyfile(self, keyfile):
532
532
@step
533
533
def test_hotbackup_impl (self ):
534
534
""" test hotbackup feature: Cluster """
535
- # step 1: create a backup
536
- self .create_backup_and_upload ("thy_name_is_" + self .name )
537
- backup_from_step_1 = self .uploaded_backups [- 1 ]
538
-
539
- # step 2: create non-backup data
540
- self .create_non_backup_data ()
541
- self .tcp_ping_all_nodes ()
542
-
543
- # step 3: add new db server
544
- new_starter = self .get_not_running_starters ()[0 ]
545
- self .run_starter_and_wait (new_starter )
546
-
547
- # step 4: create a backup
548
- self .create_backup_and_upload ("thy_name_is_" + self .name + "_+1_server" )
549
- backup_from_step_4 = self .uploaded_backups [- 1 ]
550
-
551
- # step 5: remove old db server
552
- terminate_instance = None
553
- if not self .starter_instances [1 ].have_this_instance (self .agency .get_leader ()):
554
- terminate_instance = self .starter_instances [1 ]
555
- else :
556
- terminate_instance = self .starter_instances [2 ]
557
- terminate_instance .stop_dbserver ()
558
-
559
- # step 6: create another backup
560
- self .create_backup_and_upload ("thy_name_is_" + self .name + "_+1_server_-1server" )
561
-
562
- # step 7: download and restore backup from step 1
563
- self .download_backup (backup_from_step_1 )
564
- self .validate_local_backup (backup_from_step_1 )
565
- backups = self .list_backup ()
566
- if backups [- 1 ] != backup_from_step_1 :
567
- raise Exception ("downloaded backup has different name? " + str (backups ))
568
- self .restore_backup (backup_from_step_1 )
569
- self .tcp_ping_all_nodes ()
570
-
571
- # step 8: check data
572
- self .check_data_impl ()
573
- if not self .check_non_backup_data ():
574
- raise Exception ("data created after backup is still there??" )
575
-
576
- # step 9: add new db server
577
- new_starter2 = self .get_not_running_starters ()[0 ]
578
- self .run_starter_and_wait (new_starter2 )
579
-
580
- # step 10: download and restore backup from step 4
581
- self .download_backup (backup_from_step_4 )
582
- self .validate_local_backup (backup_from_step_4 )
583
- backups = self .list_backup ()
584
- if backups [- 1 ] != backup_from_step_4 :
585
- raise Exception ("downloaded backup has different name? " + str (backups ))
586
- self .restore_backup (backup_from_step_4 )
587
- self .tcp_ping_all_nodes ()
588
-
589
- # step 11: check data
590
- self .check_data_impl ()
591
- if not self .check_non_backup_data ():
592
- raise Exception ("data created after backup is still there??" )
535
+ with step ("step 1: create a backup" ):
536
+ self .create_backup_and_upload ("thy_name_is_" + self .name )
537
+ backup_from_step_1 = self .uploaded_backups [- 1 ]
538
+
539
+ with step ("step 2: create non-backup data" ):
540
+ self .create_non_backup_data ()
541
+ self .tcp_ping_all_nodes ()
542
+
543
+ with step ("step 3: add new db server" ):
544
+ new_starter = self .get_not_running_starters ()[0 ]
545
+ self .run_starter_and_wait (new_starter )
546
+ self .backup_instance_count += 1
547
+
548
+ with step ("step 4: create a backup" ):
549
+ self .create_backup_and_upload ("thy_name_is_" + self .name + "_plus1_server" )
550
+ backup_from_step_4 = self .uploaded_backups [- 1 ]
551
+
552
+ with step ("step 5: remove old db server" ):
553
+ if not self .starter_instances [1 ].have_this_instance (self .agency .get_leader ()):
554
+ terminate_instance = self .starter_instances [1 ]
555
+ else :
556
+ terminate_instance = self .starter_instances [2 ]
557
+ terminated_dbserver_uuid = terminate_instance .get_dbserver ().get_uuid ()
558
+ terminate_instance .stop_dbserver ()
559
+ self .remove_server_from_agency (terminated_dbserver_uuid )
560
+ self .backup_instance_count -= 1
561
+
562
+ with step ("step 6: create another backup" ):
563
+ self .create_backup_and_upload ("thy_name_is_" + self .name + "_plus1_server_minus1_server" )
564
+
565
+ with step ("step 7: download and restore backup from step 1" ):
566
+ self .download_backup (backup_from_step_1 )
567
+ self .validate_local_backup (backup_from_step_1 )
568
+ backups = self .list_backup ()
569
+ if backups [- 1 ] != backup_from_step_1 :
570
+ raise Exception ("downloaded backup has different name? " + str (backups ))
571
+ self .restore_backup (backup_from_step_1 )
572
+ self .tcp_ping_all_nodes ()
573
+
574
+ with step ("step 8: check data" ):
575
+ self .check_data_impl ()
576
+ if not self .check_non_backup_data ():
577
+ raise Exception ("data created after backup is still there??" )
578
+
579
+ with step ("step 9: add new db server" ):
580
+ new_starter2 = self .get_not_running_starters ()[0 ]
581
+ self .run_starter_and_wait (new_starter2 )
582
+
583
+ with step ("step 10: download and restore backup from step 4" ):
584
+ self .download_backup (backup_from_step_4 )
585
+ self .validate_local_backup (backup_from_step_4 )
586
+ backups = self .list_backup ()
587
+ if backups [- 1 ] != backup_from_step_4 :
588
+ raise Exception ("downloaded backup has different name? " + str (backups ))
589
+ self .restore_backup (backup_from_step_4 )
590
+ self .tcp_ping_all_nodes ()
591
+
592
+ with step ("step 11: check data" ):
593
+ self .check_data_impl ()
594
+ if not self .check_non_backup_data ():
595
+ raise Exception ("data created after backup is still there??" )
593
596
594
597
@staticmethod
595
598
def run_starter_and_wait (starter ):
0 commit comments