sk77github / mysql-master-ha

Automatically exported from code.google.com/p/mysql-master-ha
0 stars 0 forks source link

errors about uninitialized 'escaped_password' host attribute #44

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Blank mysql password (not sure this is required)
2. Run master_ha_check_repl
3. See error:

Tue Dec 11 10:07:59 2012 - [info] Checking SSH publickey authentication and 
checking recovery script configurations on all alive slave servers..
Tue Dec 11 10:07:59 2012 - [info]   Executing command : apply_diff_relay_logs 
--command=test --slave_user='root' --slave_host=33.33.33.12 
--slave_ip=33.33.33.12 --slave_port=3306 --workdir=/var/log/masterha/app1 
--target_version=5.1.66-0ubuntu0.11.10.3-log --manager_version=0.54 
--relay_log_info=/var/lib/mysql/relay-log.info  --relay_dir=/var/lib/mysql/  
--slave_pass=xxx  
Tue Dec 11 10:07:59 2012 - [error][/usr/share/perl5/MHA/MasterMonitor.pm, 
ln386] Error happend on checking configurations. Use of uninitialized value in 
string ne at /usr/share/perl5/MHA/MasterMonitor.pm line 186.  
Tue Dec 11 10:07:59 2012 - [error][/usr/share/perl5/MHA/MasterMonitor.pm, 
ln482] Error happened on monitoring servers.  
Tue Dec 11 10:07:59 2012 - [info] Got exit code 1 (Not master dead).
  MySQL Replication Health is NOT OK!

What is the expected output? What do you see instead?

replication health ok, no errors.  

What version of the product are you using? On what operating system?

MHA 0.54_0, Ubuntu Oneric, this vagrant install: 
https://github.com/jayjanssen/vagrant-mysql-mha

Please provide any additional information below.

If I replace every instance of 'escaped_password' in /usr/share/perl5/MHA with 
'password', it works fine.  I could not see anywhere in the code where 
'escaped_password' was actually set.

Original issue reported on code.google.com by jay.jans...@percona.com on 11 Dec 2012 at 4:22

GoogleCodeExporter commented 8 years ago

Original comment by Yoshinor...@gmail.com on 11 Dec 2012 at 6:41

GoogleCodeExporter commented 8 years ago
Thanks for the bug report. This is a regression by introducing escaped user and 
password in 0.54. MHA get errors if empty or undefined user/password are passed.

escaped_user and escaped_password are internal parameters and are set in 
Config.pm. Here is a tentative patch. I'll run existing and new test cases and 
will release a fixed version (0.55) soon.

--- a/lib/MHA/Config.pm
+++ b/lib/MHA/Config.pm
@@ -280,14 +280,18 @@ sub parse_server {
   foreach my $key ( keys(%PARAM) ) {
     if ( $value{$key} ) {
       $value{$key} =~ s/^['"]?(.*)['"]$/$1/;
-      if ( $key eq "user" || $key eq "password" ) {
-        my $new_key = "escaped_" . $key;
-        $server->{$new_key} = MHA::NodeUtil::escape_for_shell( $value{$key} );
-      }
     }
     $server->{$key} = $value{$key};
   }
-
+  # set escaped_user and escaped_password
+  foreach my $key ('user', 'password') {
+    my $new_key = "escaped_" . $key;
+    if($server->{$key}) {
+      $server->{$new_key} = MHA::NodeUtil::escape_for_shell( $value{$key} );
+    }else {
+      $server->{$new_key} = "";
+    }
+  }
   return $server;
 }

Original comment by Yoshinor...@gmail.com on 11 Dec 2012 at 8:56

GoogleCodeExporter commented 8 years ago
Fix committed to GitHub branch. https://github.com/yoshinorim/mha4mysql-manager

Original comment by Yoshinor...@gmail.com on 12 Dec 2012 at 9:33

GoogleCodeExporter commented 8 years ago

Original comment by Yoshinor...@gmail.com on 12 Dec 2012 at 8:39