Merge pull request #193 from jacobbednarz/3.0

Turn off statement based binlog checks
This commit is contained in:
Carlos Salguero
2017-05-24 14:21:54 -03:00
committed by GitHub

View File

@@ -9301,35 +9301,36 @@ sub main {
die "Error setting SQL_MODE" die "Error setting SQL_MODE"
. ": $EVAL_ERROR"; . ": $EVAL_ERROR";
} }
# https://bugs.launchpad.net/percona-toolkit/+bug/919352 if ( $o->get('check-binlog-format') ) {
# The tool shouldn't blindly attempt to change binlog_format; # https://bugs.launchpad.net/percona-toolkit/+bug/919352
# instead, it should check if it's already set to STATEMENT. # The tool shouldn't blindly attempt to change binlog_format;
# This is becase starting with MySQL 5.1.29, changing the format # instead, it should check if it's already set to STATEMENT.
# requires a SUPER user. # This is becase starting with MySQL 5.1.29, changing the format
if ( VersionParser->new($dbh) >= '5.1.5' ) { # requires a SUPER user.
$sql = 'SELECT @@binlog_format'; if ( VersionParser->new($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 !~ /STATEMENT/i ) { PTDEBUG && _d('Original binlog_format:', $original_binlog_format);
$sql = q{/*!50108 SET @@binlog_format := 'STATEMENT'*/}; if ( $original_binlog_format !~ /STATEMENT/i ) {
eval { $sql = q{/*!50108 SET @@binlog_format := 'STATEMENT'*/};
PTDEBUG && _d($dbh, $sql); eval {
$dbh->do($sql); PTDEBUG && _d($dbh, $sql);
}; $dbh->do($sql);
if ( $EVAL_ERROR ) { };
die "Failed to $sql: $EVAL_ERROR\n" if ( $EVAL_ERROR ) {
. "This tool requires binlog_format=STATEMENT, " die "Failed to $sql: $EVAL_ERROR\n"
. "but the current binlog_format is set to " . "This tool requires binlog_format=STATEMENT, "
."$original_binlog_format and an error occurred while " . "but the current binlog_format is set to "
. "attempting to change it. If running MySQL 5.1.29 or newer, " ."$original_binlog_format and an error occurred while "
. "setting binlog_format requires the SUPER privilege. " . "attempting to change it. If running MySQL 5.1.29 or newer, "
. "You will need to manually set binlog_format to 'STATEMENT' " . "setting binlog_format requires the SUPER privilege. "
. "before running this tool.\n"; . "You will need to manually set binlog_format to 'STATEMENT' "
} . "before running this tool.\n";
} }
}
}
} }
# Set transaction isolation level. We set binlog_format to STATEMENT, # Set transaction isolation level. We set binlog_format to STATEMENT,