Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed MHA online switch master,when orig_master and new_master is same. #63

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/MHA/HealthCheck.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions lib/MHA/MasterMonitor.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
5 changes: 5 additions & 0 deletions lib/MHA/MasterRotate.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down