Skip to content

Commit c460ac5

Browse files
authored
Add an option to specify seconds behind master limit when calling masterha_master_switch
Previously `masterha_master_switch` did not perform failover if replication lag was higher than `g_running_updates_limit` which is `1` by default. The new setting `seconds_behind_master` is now set to a default of `30`.
2 parents 767a070 + 80f03d7 commit c460ac5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/MHA/MasterRotate.pm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ my $g_flush_tables = 2;
4747
my $g_orig_master_is_new_slave;
4848
my $g_running_updates_limit = 1;
4949
my $g_running_seconds_limit = 10;
50+
my $g_seconds_behind_master = 30;
5051
my $g_skip_lock_all_tables;
5152
my $g_remove_orig_master_conf;
5253
my $g_interactive = 1;
@@ -153,7 +154,7 @@ sub identify_orig_master() {
153154
}
154155
}
155156

156-
$_server_manager->check_replication_health($g_running_updates_limit);
157+
$_server_manager->check_replication_health($g_seconds_behind_master);
157158

158159
my @threads =
159160
$orig_master->get_running_update_threads( $g_running_updates_limit + 1 );
@@ -718,6 +719,7 @@ sub main {
718719
'orig_master_is_new_slave' => \$g_orig_master_is_new_slave,
719720
'running_updates_limit=i' => \$g_running_updates_limit,
720721
'running_seconds_limit=i' => \$g_running_seconds_limit,
722+
'seconds_behind_master=i' => \$g_seconds_behind_master,
721723
'skip_lock_all_tables' => \$g_skip_lock_all_tables,
722724
'remove_dead_master_conf' => \$g_remove_orig_master_conf,
723725
'remove_orig_master_conf' => \$g_remove_orig_master_conf,

0 commit comments

Comments
 (0)