From 81efd315e2a48ce67414ee841cf1eecb3144d462 Mon Sep 17 00:00:00 2001 From: Carlos Salguero Date: Fri, 18 May 2018 12:42:51 -0300 Subject: [PATCH] PT-1556 binlog_format should be STATEMENT on master On the master, binlog_format should be always STATEMENT on master Resolves: #PT-1527 --- bin/pt-table-checksum | 46 +++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/bin/pt-table-checksum b/bin/pt-table-checksum index b891dcf7..db762e08 100755 --- a/bin/pt-table-checksum +++ b/bin/pt-table-checksum @@ -10052,30 +10052,28 @@ sub main { # instead, it should check if it's already set to STATEMENT. # This is becase starting with MySQL 5.1.29, changing the format # requires a SUPER user. - if ( $o->get('check-binlog-format') ) { - if ( VersionParser->new($dbh) >= '5.1.5' ) { - $sql = 'SELECT @@binlog_format'; - PTDEBUG && _d($dbh, $sql); - my ($original_binlog_format) = $dbh->selectrow_array($sql); - PTDEBUG && _d('Original binlog_format:', $original_binlog_format); - if ( $original_binlog_format !~ /STATEMENT/i ) { - $sql = q{/*!50108 SET @@binlog_format := 'STATEMENT'*/}; - eval { - PTDEBUG && _d($dbh, $sql); - $dbh->do($sql); - }; - if ( $EVAL_ERROR ) { - die "Failed to $sql: $EVAL_ERROR\n" - . "This tool requires binlog_format=STATEMENT, " - . "but the current binlog_format is set to " - ."$original_binlog_format and an error occurred while " - . "attempting to change it. If running MySQL 5.1.29 or newer, " - . "setting binlog_format requires the SUPER privilege. " - . "You will need to manually set binlog_format to 'STATEMENT' " - . "before running this tool.\n"; - } - } - } + if ( VersionParser->new($dbh) >= '5.1.5' ) { + $sql = 'SELECT @@binlog_format'; + PTDEBUG && _d($dbh, $sql); + my ($original_binlog_format) = $dbh->selectrow_array($sql); + PTDEBUG && _d('Original binlog_format:', $original_binlog_format); + if ( $original_binlog_format !~ /STATEMENT/i ) { + $sql = q{/*!50108 SET @@binlog_format := 'STATEMENT'*/}; + eval { + PTDEBUG && _d($dbh, $sql); + $dbh->do($sql); + }; + if ( $EVAL_ERROR ) { + die "Failed to $sql: $EVAL_ERROR\n" + . "This tool requires binlog_format=STATEMENT, " + . "but the current binlog_format is set to " + ."$original_binlog_format and an error occurred while " + . "attempting to change it. If running MySQL 5.1.29 or newer, " + . "setting binlog_format requires the SUPER privilege. " + . "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,