From 153433fcff8de46a442130fa2501a632123c2a84 Mon Sep 17 00:00:00 2001 From: liucyao Date: Tue, 19 Apr 2016 19:02:35 +0800 Subject: [PATCH 1/4] fix MHA online switch master,when orig_master and new_master is same. when you switch master online,masterha_master_switch --master_state=alive --conf=/etc/masterha/app1.conf --new_master_host=xxxx --new_master_port=xxx, you new_master_host and new_master_port is same as you orig_master_host orig_master_port,MHA will execute function reject_update,it cause master failover vip change and set read_only on it until master_pos_wait exit. --- lib/MHA/MasterRotate.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/MHA/MasterRotate.pm b/lib/MHA/MasterRotate.pm index cf630f4..bebe537 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.." + } + $log->info("** Phase 1: Configuration Check Phase completed.\n"); $log->info(); From a2159650cba665d7cd275af5ba9da9944ad3f4e0 Mon Sep 17 00:00:00 2001 From: liucyao Date: Tue, 19 Apr 2016 19:04:13 +0800 Subject: [PATCH 2/4] Update MasterRotate.pm --- lib/MHA/MasterRotate.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/MHA/MasterRotate.pm b/lib/MHA/MasterRotate.pm index bebe537..0347ca2 100644 --- a/lib/MHA/MasterRotate.pm +++ b/lib/MHA/MasterRotate.pm @@ -623,7 +623,7 @@ sub do_master_online_switch { 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.." + croak "new_master is equal as orig_master, no need to switch master!\n"; } $log->info("** Phase 1: Configuration Check Phase completed.\n"); From 8c7edc140ea3aee16ba682862bebb51a246aca6b Mon Sep 17 00:00:00 2001 From: liucyao Date: Thu, 21 Apr 2016 17:51:00 +0800 Subject: [PATCH 3/4] Update MasterMonitor.pm --- lib/MHA/MasterMonitor.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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"; From 6e5417dcc99968c375b4932b833086e4cb1d971f Mon Sep 17 00:00:00 2001 From: liucyao Date: Sun, 24 Apr 2016 18:18:45 +0800 Subject: [PATCH 4/4] Update HealthCheck.pm --- lib/MHA/HealthCheck.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;