disables only_full_group_by

This commit is contained in:
Frank Cizmich
2015-01-05 20:15:27 -02:00
parent 732a3fa9cc
commit ee5e46e08c
2 changed files with 39 additions and 0 deletions

View File

@@ -9131,6 +9131,26 @@ sub main {
return if $o->get('explain');
my $sql;
# https://bugs.launchpad.net/percona-toolkit/+bug/1019479
# sql_mode ONLY_FULL_GROUP_BY often raises error even when query is
# safe and deterministic. It's best to turn it off for the session
# at this point.
$sql = 'SELECT @@SQL_MODE';
PTDEBUG && _d($dbh, $sql);
my ($sql_mode) = eval { $dbh->selectrow_array($sql) };
if ( $EVAL_ERROR ) {
die "Error getting the current SQL_MODE: $EVAL_ERROR";
}
$sql_mode =~ s/ONLY_FULL_GROUP_BY//i;
$sql = qq[SET SQL_MODE='$sql_mode'];
PTDEBUG && _d($dbh, $sql);
eval { $dbh->do($sql) };
if ( $EVAL_ERROR ) {
die "Error setting SQL_MODE"
. ": $EVAL_ERROR";
}
# https://bugs.launchpad.net/percona-toolkit/+bug/919352
# The tool shouldn't blindly attempt to change binlog_format;
# instead, it should check if it's already set to STATEMENT.

View File

@@ -56,6 +56,7 @@ sub reset_repl_db {
$master_dbh->do("use $repl_db");
}
# ############################################################################
# Default checksum and results. The tool does not technically require any
# options on well-configured systems (which the test env cannot be). With
@@ -508,6 +509,24 @@ is(
"Bug 821675 (dot): 0 errors"
);
# #############################################################################
# Bug 1019479: does not work with sql_mode ONLY_FULL_GROUP_BY
# #############################################################################
# add a couple more modes to test that commas don't affect setting
$master_dbh->do("SET sql_mode = 'NO_ZERO_DATE,ONLY_FULL_GROUP_BY,STRICT_ALL_TABLES'");
# force chunk-size because bug doesn't show up if table done in one chunk
$exit_status = pt_table_checksum::main(@args,
qw(--quiet --quiet -t sakila.actor --chunk-size=50));
is(
$exit_status,
0,
"sql_mode ONLY_FULL_GROUP_BY is overidden"
);
# #############################################################################
# Done.
# #############################################################################