mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-27 07:54:58 +00:00
disables only_full_group_by
This commit is contained in:
@@ -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.
|
||||
|
@@ -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.
|
||||
# #############################################################################
|
||||
|
Reference in New Issue
Block a user