diff --git a/lib/MHA/HealthCheck.pm b/lib/MHA/HealthCheck.pm index 8f2099e..d888517 100644 --- a/lib/MHA/HealthCheck.pm +++ b/lib/MHA/HealthCheck.pm @@ -119,7 +119,7 @@ sub connect { "MySQL Ping($self->{ping_type})" ); }; if ($@) { - my $msg = "Unexpected error heppened when pinging! $@"; + my $msg = "Unexpected error happened when pinging! $@"; $log->error($msg); undef $@; $child_exit_code = 1; diff --git a/lib/MHA/MasterMonitor.pm b/lib/MHA/MasterMonitor.pm index 2a6ac56..e608094 100644 --- a/lib/MHA/MasterMonitor.pm +++ b/lib/MHA/MasterMonitor.pm @@ -166,11 +166,11 @@ sub check_binlog($) { } sub check_slave_env() { - my @alive_servers = $_server_manager->get_alive_slaves(); + my @alive_slaves = $_server_manager->get_alive_slaves(); $log->info( "Checking SSH publickey authentication and checking recovery script configurations on all alive slave servers.." ); - foreach my $s (@alive_servers) { + foreach my $s (@alive_slaves) { my $ssh_user_host = $s->{ssh_user} . '@' . $s->{ssh_ip}; my $command = "apply_diff_relay_logs --command=test --slave_user=$s->{escaped_user} --slave_host=$s->{hostname} --slave_ip=$s->{ip} --slave_port=$s->{port} --workdir=$s->{remote_workdir} --target_version=$s->{mysql_version} --manager_version=$MHA::ManagerConst::VERSION"; diff --git a/lib/MHA/MasterRotate.pm b/lib/MHA/MasterRotate.pm index cf630f4..0347ca2 100644 --- a/lib/MHA/MasterRotate.pm +++ b/lib/MHA/MasterRotate.pm @@ -621,6 +621,11 @@ sub do_master_online_switch { eval { $orig_master = identify_orig_master(); my $new_master = identify_new_master($orig_master); + + if ($orig_master->{id} == $new_master->{id}){ + croak "new_master is equal as orig_master, no need to switch master!\n"; + } + $log->info("** Phase 1: Configuration Check Phase completed.\n"); $log->info();