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

Perl 5.24.1: Redundant argument in sprintf at /usr/local/share/perl/5.24.1/MHA/NodeUtil.pm line 195 #116

Open
Cugar15 opened this issue Nov 9, 2018 · 5 comments

Comments

@Cugar15
Copy link

Cugar15 commented Nov 9, 2018

With Perl 5.24.1 in NodeUtil.pl the following error occurs:

masterha_check_repl --conf=/etc/mha/app1.cnf

Fri Nov  9 10:28:01 2018 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Fri Nov  9 10:28:01 2018 - [info] Reading application default configuration from /etc/mha/app1.cnf..
Fri Nov  9 10:28:01 2018 - [info] Reading server configuration from /etc/mha/app1.cnf..
Fri Nov  9 10:28:01 2018 - [info] MHA::MasterMonitor version 0.58.
Fri Nov  9 10:28:03 2018 - [error][/usr/local/share/perl/5.24.1/MHA/MasterMonitor.pm, ln427] Error happened on checking configurations. Redundant argument in sprintf at /usr/local/share/perl/5.24.1/MHA/NodeUtil.pm line 195.
Fri Nov  9 10:28:03 2018 - [error][/usr/local/share/perl/5.24.1/MHA/MasterMonitor.pm, ln525] Error happened on monitoring servers.
Fri Nov  9 10:28:03 2018 - [info] Got exit code 1 (Not master dead).

The problem is the mysql version string which is: 5.7.22-ndb-7.6.6-log and the strict assignment of

sub parse_mysql_version($) {
  my $str = shift;
  my $result = sprintf( '%03d%03d%03d', $str =~ m/(\d+)/g );    <-----
  return $result;
}

A possible solution is to cut everything in the version string past the "-" like:

sub parse_mysql_version($) {
  my $str = shift;
 ($str) =  $str =~ m/^[^-]*/g;
  my $result = sprintf( '%03d%03d%03d', $str =~ m/(\d+)/g );
  return $result;
}

A better regex wizzard than me can probably do this much slicker :)

The overall question is: Are there more of these occurrences and how can they be found?

Cheers

@qiukeren
Copy link

need help +1 here

@qiukeren
Copy link

what plus here is parse_mysql_major_version still have same issue,so we can change here:

sub parse_mysql_major_version($) {
  my $str = shift;
  $str =~ /(\d+)\.(\d+)/;
  my $strmajor = "$1.$2";
  my $result = sprintf( '%03d%03d', $strmajor =~ m/(\d+)/g );
  return $result;
}


@frankgululu
Copy link

I have same issue after changed all mha node and master

@vfzh
Copy link

vfzh commented Apr 29, 2022

thanks for your answer~

@KAispread
Copy link

Thanks for your comment!!😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants