mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 05:00:45 +00:00
Use VersionParser to check for MySQL 5.1 before checking binlog_format.
This commit is contained in:
@@ -5877,36 +5877,39 @@ sub main {
|
|||||||
# ########################################################################
|
# ########################################################################
|
||||||
# Connect to the master.
|
# Connect to the master.
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
|
my $vp = new VersionParser();
|
||||||
|
|
||||||
my $set_on_connect = sub {
|
my $set_on_connect = sub {
|
||||||
my ($dbh) = @_;
|
my ($dbh) = @_;
|
||||||
|
|
||||||
return if $o->get('explain');
|
return if $o->get('explain');
|
||||||
|
my $sql;
|
||||||
|
|
||||||
# https://bugs.launchpad.net/percona-toolkit/+bug/919352
|
# https://bugs.launchpad.net/percona-toolkit/+bug/919352
|
||||||
# The tool shouldn't blindly attempt to change binlog_format;
|
# The tool shouldn't blindly attempt to change binlog_format;
|
||||||
# instead, it should check if it's already set to STATEMENT.
|
# instead, it should check if it's already set to STATEMENT.
|
||||||
# This is becase starting with MySQL 5.1.29, changing the format
|
# This is becase starting with MySQL 5.1.29, changing the format
|
||||||
# requires a SUPER user.
|
# requires a SUPER user.
|
||||||
my $sql = '/*!50108 SELECT @@binlog_format */';
|
if ( $vp->version_ge($dbh, '5.1.5') ) {
|
||||||
PTDEBUG && _d($dbh, $sql);
|
$sql = 'SELECT @@binlog_format';
|
||||||
my ($original_binlog_format) = $dbh->selectrow_array($sql);
|
PTDEBUG && _d($dbh, $sql);
|
||||||
PTDEBUG && _d('Original binlog_format:', $original_binlog_format);
|
my ($original_binlog_format) = $dbh->selectrow_array($sql);
|
||||||
if ( $original_binlog_format
|
PTDEBUG && _d('Original binlog_format:', $original_binlog_format);
|
||||||
&& $original_binlog_format !~ /STATEMENT/i ) {
|
if ( $original_binlog_format !~ /STATEMENT/i ) {
|
||||||
$sql = q{/*!50108 SET @@binlog_format := 'STATEMENT'*/};
|
$sql = q{/*!50108 SET @@binlog_format := 'STATEMENT'*/};
|
||||||
eval {
|
eval {
|
||||||
PTDEBUG && _d($dbh, $sql);
|
PTDEBUG && _d($dbh, $sql);
|
||||||
$dbh->do($sql);
|
$dbh->do($sql);
|
||||||
};
|
};
|
||||||
if ( $EVAL_ERROR ) {
|
if ( $EVAL_ERROR ) {
|
||||||
die "Failed to $sql: $EVAL_ERROR\n"
|
die "Failed to $sql: $EVAL_ERROR\n"
|
||||||
. "This tool requires binlog_format=STATEMENT, "
|
. "This tool requires binlog_format=STATEMENT, "
|
||||||
. "but the current binlog_format is set to "
|
. "but the current binlog_format is set to "
|
||||||
."$original_binlog_format and an error occurred while "
|
."$original_binlog_format and an error occurred while "
|
||||||
. "attempting to change it. If running MySQL 5.1.29 or newer, "
|
. "attempting to change it. If running MySQL 5.1.29 or newer, "
|
||||||
. "setting binlog_format requires the SUPER privilege. "
|
. "setting binlog_format requires the SUPER privilege. "
|
||||||
. "You will need to manually set binlog_format to 'STATEMENT' "
|
. "You will need to manually set binlog_format to 'STATEMENT' "
|
||||||
. "before running this tool.\n";
|
. "before running this tool.\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5996,7 +5999,6 @@ sub main {
|
|||||||
my $q = new Quoter();
|
my $q = new Quoter();
|
||||||
my $tp = new TableParser(Quoter => $q);
|
my $tp = new TableParser(Quoter => $q);
|
||||||
my $rc = new RowChecksum(Quoter=> $q, OptionParser => $o);
|
my $rc = new RowChecksum(Quoter=> $q, OptionParser => $o);
|
||||||
my $vp = new VersionParser();
|
|
||||||
my $ms = new MasterSlave(VersionParser => $vp);
|
my $ms = new MasterSlave(VersionParser => $vp);
|
||||||
|
|
||||||
my $slaves; # all slaves (that we can find)
|
my $slaves; # all slaves (that we can find)
|
||||||
|
Reference in New Issue
Block a user