Fix for bug#13783 mysqlcheck tries to optimize and analyze information_schema

  'information_schema' is excluded from list of databases for mysqlcheck command
parent 7a57b741
...@@ -497,6 +497,9 @@ static int process_all_tables_in_db(char *database) ...@@ -497,6 +497,9 @@ static int process_all_tables_in_db(char *database)
static int use_db(char *database) static int use_db(char *database)
{ {
if (mysql_get_server_version(sock) >= 50003 &&
!my_strcasecmp(&my_charset_latin1, database, "information_schema"))
return 1;
if (mysql_select_db(sock, database)) if (mysql_select_db(sock, database))
{ {
DBerror(sock, "when selecting the database"); DBerror(sock, "when selecting the database");
......
...@@ -171,6 +171,7 @@ our $exe_mysqladmin; ...@@ -171,6 +171,7 @@ our $exe_mysqladmin;
our $exe_mysqlbinlog; our $exe_mysqlbinlog;
our $exe_mysql_client_test; our $exe_mysql_client_test;
our $exe_mysqld; our $exe_mysqld;
our $exe_mysqlcheck; # Called from test case
our $exe_mysqldump; # Called from test case our $exe_mysqldump; # Called from test case
our $exe_mysqlshow; # Called from test case our $exe_mysqlshow; # Called from test case
our $exe_mysql_fix_system_tables; our $exe_mysql_fix_system_tables;
...@@ -911,6 +912,7 @@ sub executable_setup () { ...@@ -911,6 +912,7 @@ sub executable_setup () {
mtr_exe_exists("$glob_basedir/tests/mysql_client_test", mtr_exe_exists("$glob_basedir/tests/mysql_client_test",
"/usr/bin/false"); "/usr/bin/false");
} }
$exe_mysqlcheck= mtr_exe_exists("$path_client_bindir/mysqlcheck");
$exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump"); $exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump");
$exe_mysqlshow= mtr_exe_exists("$path_client_bindir/mysqlshow"); $exe_mysqlshow= mtr_exe_exists("$path_client_bindir/mysqlshow");
$exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog"); $exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog");
...@@ -926,6 +928,7 @@ sub executable_setup () { ...@@ -926,6 +928,7 @@ sub executable_setup () {
else else
{ {
$path_client_bindir= mtr_path_exists("$glob_basedir/bin"); $path_client_bindir= mtr_path_exists("$glob_basedir/bin");
$exe_mysqlcheck= mtr_exe_exists("$path_client_bindir/mysqlcheck");
$exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump"); $exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump");
$exe_mysqlshow= mtr_exe_exists("$path_client_bindir/mysqlshow"); $exe_mysqlshow= mtr_exe_exists("$path_client_bindir/mysqlshow");
$exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog"); $exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog");
...@@ -2354,6 +2357,15 @@ sub im_stop($) { ...@@ -2354,6 +2357,15 @@ sub im_stop($) {
sub run_mysqltest ($) { sub run_mysqltest ($) {
my $tinfo= shift; my $tinfo= shift;
my $cmdline_mysqlcheck= "$exe_mysqlcheck --no-defaults -uroot " .
"--port=$master->[0]->{'path_myport'} " .
"--socket=$master->[0]->{'path_mysock'} --password=";
if ( $opt_debug )
{
$cmdline_mysqlcheck .=
" --debug=d:t:A,$opt_vardir/log/mysqldump.trace";
}
my $cmdline_mysqldump= "$exe_mysqldump --no-defaults -uroot " . my $cmdline_mysqldump= "$exe_mysqldump --no-defaults -uroot " .
"--port=$master->[0]->{'path_myport'} " . "--port=$master->[0]->{'path_myport'} " .
"--socket=$master->[0]->{'path_mysock'} --password="; "--socket=$master->[0]->{'path_mysock'} --password=";
...@@ -2413,6 +2425,7 @@ sub run_mysqltest ($) { ...@@ -2413,6 +2425,7 @@ sub run_mysqltest ($) {
# $ENV{'PATH'}= "/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin:/usr/openwin/bin:/usr/bin/X11:$ENV{'PATH'}"; # $ENV{'PATH'}= "/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin:/usr/openwin/bin:/usr/bin/X11:$ENV{'PATH'}";
$ENV{'MYSQL'}= $cmdline_mysql; $ENV{'MYSQL'}= $cmdline_mysql;
$ENV{'MYSQL_CHECK'}= $cmdline_mysqlcheck;
$ENV{'MYSQL_DUMP'}= $cmdline_mysqldump; $ENV{'MYSQL_DUMP'}= $cmdline_mysqldump;
$ENV{'MYSQL_SHOW'}= $cmdline_mysqlshow; $ENV{'MYSQL_SHOW'}= $cmdline_mysqlshow;
$ENV{'MYSQL_BINLOG'}= $cmdline_mysqlbinlog; $ENV{'MYSQL_BINLOG'}= $cmdline_mysqlbinlog;
......
...@@ -222,6 +222,7 @@ FAILED_CASES= ...@@ -222,6 +222,7 @@ FAILED_CASES=
EXTRA_MASTER_OPT="" EXTRA_MASTER_OPT=""
EXTRA_MYSQL_TEST_OPT="" EXTRA_MYSQL_TEST_OPT=""
EXTRA_MYSQLCHECK_OPT=""
EXTRA_MYSQLDUMP_OPT="" EXTRA_MYSQLDUMP_OPT=""
EXTRA_MYSQLSHOW_OPT="" EXTRA_MYSQLSHOW_OPT=""
EXTRA_MYSQLBINLOG_OPT="" EXTRA_MYSQLBINLOG_OPT=""
...@@ -455,6 +456,8 @@ while test $# -gt 0; do ...@@ -455,6 +456,8 @@ while test $# -gt 0; do
--debug=d:t:i:A,$MYSQL_TEST_DIR/var/log/slave.trace" --debug=d:t:i:A,$MYSQL_TEST_DIR/var/log/slave.trace"
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT \ EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT \
--debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqltest.trace" --debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqltest.trace"
EXTRA_MYSQLCHECK_OPT="$EXTRA_MYSQLCHECK_OPT \
--debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqlcheck.trace"
EXTRA_MYSQLDUMP_OPT="$EXTRA_MYSQLDUMP_OPT \ EXTRA_MYSQLDUMP_OPT="$EXTRA_MYSQLDUMP_OPT \
--debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqldump.trace" --debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqldump.trace"
EXTRA_MYSQLSHOW_OPT="$EXTRA_MYSQLSHOW_OPT \ EXTRA_MYSQLSHOW_OPT="$EXTRA_MYSQLSHOW_OPT \
...@@ -557,6 +560,11 @@ if [ x$SOURCE_DIST = x1 ] ; then ...@@ -557,6 +560,11 @@ if [ x$SOURCE_DIST = x1 ] ; then
fi fi
MYSQL_CLIENT_TEST="$BASEDIR/tests/mysql_client_test" MYSQL_CLIENT_TEST="$BASEDIR/tests/mysql_client_test"
fi fi
if [ -f "$BASEDIR/client/.libs/mysqlcheck" ] ; then
MYSQL_CHECK="$BASEDIR/client/.libs/mysqlcheck"
else
MYSQL_CHECK="$BASEDIR/client/mysqlcheck"
fi
if [ -f "$BASEDIR/client/.libs/mysqldump" ] ; then if [ -f "$BASEDIR/client/.libs/mysqldump" ] ; then
MYSQL_DUMP="$BASEDIR/client/.libs/mysqldump" MYSQL_DUMP="$BASEDIR/client/.libs/mysqldump"
else else
...@@ -635,6 +643,7 @@ else ...@@ -635,6 +643,7 @@ else
TESTS_BINDIR="$BASEDIR/bin" TESTS_BINDIR="$BASEDIR/bin"
fi fi
MYSQL_TEST="$CLIENT_BINDIR/mysqltest" MYSQL_TEST="$CLIENT_BINDIR/mysqltest"
MYSQL_CHECK="$CLIENT_BINDIR/mysqlcheck"
MYSQL_DUMP="$CLIENT_BINDIR/mysqldump" MYSQL_DUMP="$CLIENT_BINDIR/mysqldump"
MYSQL_SHOW="$CLIENT_BINDIR/mysqlshow" MYSQL_SHOW="$CLIENT_BINDIR/mysqlshow"
MYSQL_BINLOG="$CLIENT_BINDIR/mysqlbinlog" MYSQL_BINLOG="$CLIENT_BINDIR/mysqlbinlog"
...@@ -720,12 +729,13 @@ fi ...@@ -720,12 +729,13 @@ fi
# Save path and name of mysqldump # Save path and name of mysqldump
MYSQL_DUMP_DIR="$MYSQL_DUMP" MYSQL_DUMP_DIR="$MYSQL_DUMP"
export MYSQL_DUMP_DIR export MYSQL_DUMP_DIR
MYSQL_CHECK="$MYSQL_CHECK --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLCHECK_OPT"
MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT" MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
MYSQL_SHOW="$MYSQL_SHOW -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLSHOW_OPT" MYSQL_SHOW="$MYSQL_SHOW -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLSHOW_OPT"
MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR --character-sets-dir=$CHARSETSDIR $EXTRA_MYSQLBINLOG_OPT" MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR --character-sets-dir=$CHARSETSDIR $EXTRA_MYSQLBINLOG_OPT"
MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose" MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose"
MYSQL="$MYSQL --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD" MYSQL="$MYSQL --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD"
export MYSQL MYSQL_DUMP MYSQL_SHOW MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES export MYSQL MYSQL_CHECK MYSQL_DUMP MYSQL_SHOW MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES
export CLIENT_BINDIR MYSQL_CLIENT_TEST CHARSETSDIR MYSQL_MY_PRINT_DEFAULTS export CLIENT_BINDIR MYSQL_CLIENT_TEST CHARSETSDIR MYSQL_MY_PRINT_DEFAULTS
export NDB_TOOLS_DIR export NDB_TOOLS_DIR
export NDB_MGM export NDB_MGM
...@@ -757,7 +767,7 @@ if [ -n "$DO_CLIENT_GDB" -o -n "$DO_GDB" ] ; then ...@@ -757,7 +767,7 @@ if [ -n "$DO_CLIENT_GDB" -o -n "$DO_GDB" ] ; then
XTERM=`which xterm` XTERM=`which xterm`
fi fi
export MYSQL MYSQL_DUMP MYSQL_SHOW MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES CLIENT_BINDIR MASTER_MYSOCK export MYSQL MYSQL_CHECK MYSQL_DUMP MYSQL_SHOW MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES CLIENT_BINDIR MASTER_MYSOCK
#++ #++
# Function Definitions # Function Definitions
......
mysql.columns_priv OK
mysql.db OK
mysql.func OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.proc OK
mysql.procs_priv OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
mysql.columns_priv OK
mysql.db OK
mysql.func OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.proc OK
mysql.procs_priv OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
# Embedded server doesn't support external clients
--source include/not_embedded.inc
#
# Bug #13783 mysqlcheck tries to optimize and analyze information_schema
#
--replace_result 'Table is already up to date' OK
--exec $MYSQL_CHECK --all-databases --analyze --optimize
--replace_result 'Table is already up to date' OK
--exec $MYSQL_CHECK --analyze --optimize --databases test information_schema mysql
--exec $MYSQL_CHECK --analyze --optimize information_schema schemata
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment