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

Backwards compatibility fix for super_read_only #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
16 changes: 16 additions & 0 deletions lib/MHA/SlaveUtil.pm
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,15 @@ sub is_mariadb($) {
return 0;
}

sub is_perconadb($) {
my $version_str = shift;
if ($version_str =~ m/.*Percona.*/i)
{
return 1;
}
return 0;
}

sub get_advisory_lock_internal($$$) {
my $dbh = shift;
my $timeout = shift;
Expand Down Expand Up @@ -241,6 +250,13 @@ sub check_if_super_read_only {
{ PrintError => 0, RaiseError => 1 } );
croak "Failed to get DB Handle to check super_read_only on $host:$port!\n" unless ($dbh);

# Added in Percona 5.6.21, standard 5.7.8
my $mysql_version = get_version($dbh);
my $target_version = is_perconadb($mysql_version) ? "5.6.21" : "5.7.8";
if (! MHA::NodeUtil::mysql_version_ge( $mysql_version, $target_version ) ) {
return (0, 0);
}

my $sth = $dbh->prepare("SELECT \@\@global.super_read_only as Value");
$sth->execute();
my $href = $sth->fetchrow_hashref;
Expand Down