From 2c4ca510507a8055cdb58d9c0631f5d630e55d90 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 8 Apr 2008 16:51:26 +0200 Subject: [PATCH] Check warnings in servers error log as part of test case BitKeeper/deleted/.del-rpl_bug33931-slave.opt: Delete: mysql-test/suite/rpl/t/rpl_bug33931-slave.opt mysql-test/include/default_mysqld.cnf: Set a default name for "log-bin" mysql-test/mysql-test-run.pl: Check for warnings in mysqld error log files after each testcase, using SQL mysql-test/lib/mtr_cases.pm: Make mtr_match into a perl module mysql-test/lib/mtr_match.pm: Make mtr_match into a perl module mysql-test/lib/mtr_report.pm: Make mtr_match into a perl module Print warnings if testcase failed from warnings mysql-test/r/information_schema.result: Be more selective which databases and tables are select in the queries mysql-test/r/mysql_upgrade.result: Update result, mysql_upgrade will check _all_ databases mysql-test/r/mysqlcheck.result: Update result, mysql_upgrade should check _all_ databases mysql-test/r/sp-destruct.result: Be more selective which databases and tables are select in the queries mysql-test/r/sp-error.result: Backup and restore mysql.proc table mysql-test/r/sp-security.result: Be more selective which databases and tables are select in the queries mysql-test/r/sp.result: Be more selective which databases and tables are select in the queries mysql-test/suite/rpl/r/rpl_bug33931.result: Move the setting of debug flag into the test file instead of in -slave.opt Add supression mysql-test/suite/rpl/r/rpl_idempotency.result: Add supression Add master-slave-end.inc mysql-test/suite/rpl/t/rpl_bug33931.test: Move the setting of debug flag into the test file instead of in -slave.opt Add supression mysql-test/suite/rpl/t/rpl_idempotency.test: Add supression Add master-slave-end.inc mysql-test/t/information_schema.test: Be more selective which databases and tables are select in the queries mysql-test/t/sp-destruct.test: Be more selective which databases and tables are select in the queries mysql-test/t/sp-error.test: Backup and restore mysql.proc table mysql-test/t/sp-security.test: Be more selective which databases and tables are select in the queries mysql-test/t/sp.test: Be more selective which databases and tables are select in the queries mysql-test/include/check-warnings.test: New BitKeeper file ``mysql-test/include/check-warnings.test'' mysql-test/include/mtr_warnings.sql: New BitKeeper file ``mysql-test/include/mtr_warnings.sql'' --- mysql-test/include/check-warnings.test | 8 + mysql-test/include/default_mysqld.cnf | 2 +- mysql-test/include/mtr_warnings.sql | 290 ++++++++++++++++++ mysql-test/lib/mtr_cases.pm | 4 +- mysql-test/lib/{mtr_match.pl => mtr_match.pm} | 21 +- mysql-test/lib/mtr_report.pm | 248 ++------------- mysql-test/mysql-test-run.pl | 185 +++++++++-- mysql-test/r/information_schema.result | 36 ++- mysql-test/r/mysql_upgrade.result | 12 + mysql-test/r/mysqlcheck.result | 3 + mysql-test/r/sp-destruct.result | 4 +- mysql-test/r/sp-error.result | 2 + mysql-test/r/sp-security.result | 4 +- mysql-test/r/sp.result | 10 +- mysql-test/suite/rpl/r/rpl_bug33931.result | 2 + mysql-test/suite/rpl/r/rpl_idempotency.result | 2 + mysql-test/suite/rpl/t/rpl_bug33931-slave.opt | 1 - mysql-test/suite/rpl/t/rpl_bug33931.test | 8 + mysql-test/suite/rpl/t/rpl_idempotency.test | 8 +- mysql-test/t/information_schema.test | 36 ++- mysql-test/t/sp-destruct.test | 4 +- mysql-test/t/sp-error.test | 10 + mysql-test/t/sp-security.test | 4 +- mysql-test/t/sp.test | 8 +- 24 files changed, 593 insertions(+), 319 deletions(-) create mode 100644 mysql-test/include/check-warnings.test create mode 100644 mysql-test/include/mtr_warnings.sql rename mysql-test/lib/{mtr_match.pl => mtr_match.pm} (87%) delete mode 100644 mysql-test/suite/rpl/t/rpl_bug33931-slave.opt diff --git a/mysql-test/include/check-warnings.test b/mysql-test/include/check-warnings.test new file mode 100644 index 00000000000..5b451550456 --- /dev/null +++ b/mysql-test/include/check-warnings.test @@ -0,0 +1,8 @@ + +# +# This test is executed once after each test to check the servers +# for unexpected warnings found in the servers error log +# +--disable_query_log +call mtr.check_warnings(); +--enable_query_log diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf index 265f88f5bc3..ad0090aaf36 100644 --- a/mysql-test/include/default_mysqld.cnf +++ b/mysql-test/include/default_mysqld.cnf @@ -17,5 +17,5 @@ loose-innodb_data_file_path= ibdata1:10M:autoextend slave-net-timeout=120 -log-bin +log-bin=mysqld-bin diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql new file mode 100644 index 00000000000..65aa9a5842f --- /dev/null +++ b/mysql-test/include/mtr_warnings.sql @@ -0,0 +1,290 @@ +delimiter ||; + +use mtr|| + +-- +-- Load table with the patterns that are considered +-- as suspicious and should be examined further +-- +CREATE TABLE suspicious_patterns ( + pattern VARCHAR(255) +)|| + + +-- +-- Declare a trigger that makes sure +-- no invalid patterns can be inserted +-- into suspicious_patterns +-- +/*!50002 +CREATE DEFINER=root@localhost TRIGGER sp_insert +BEFORE INSERT ON suspicious_patterns +FOR EACH ROW BEGIN + DECLARE dummy INT; + SELECT "" REGEXP NEW.pattern INTO dummy; +END +*/|| + + +-- +-- Insert patterns for the lines we should check +-- +INSERT INTO suspicious_patterns VALUES + ("^Warning:|mysqld: Warning|\\[Warning\\]"), + ("^Error:|\\[ERROR\\]"), + ("^==.* at 0x"), + ("InnoDB: Warning"), + ("^safe_mutex:|allocated at line"), + ("missing DBUG_RETURN"), + ("Attempting backtrace"), + ("Assertion .* failed")|| + + +-- +-- Create table where testcases can insert patterns to +-- be supressed +-- +CREATE TABLE test_supressions ( + pattern VARCHAR(255) +)|| + + +-- +-- Declare a trigger that makes sure +-- no invalid patterns can be inserted +-- into test_supressions +-- +/*!50002 +CREATE DEFINER=root@localhost TRIGGER ts_insert +BEFORE INSERT ON test_supressions +FOR EACH ROW BEGIN + DECLARE dummy INT; + SELECT "" REGEXP NEW.pattern INTO dummy; +END +*/|| + + +-- +-- Load table with patterns that will be supressed globally(always) +-- +CREATE TABLE global_supressions ( + pattern VARCHAR(255) +)|| + + +-- Declare a trigger that makes sure +-- no invalid patterns can be inserted +-- into global_supressions +-- +/*!50002 +CREATE DEFINER=root@localhost TRIGGER gs_insert +BEFORE INSERT ON global_supressions +FOR EACH ROW BEGIN + DECLARE dummy INT; + SELECT "" REGEXP NEW.pattern INTO dummy; +END +*/|| + + + +-- +-- Insert patterns that should always be supressed +-- +INSERT INTO global_supressions VALUES + ("'SELECT UNIX_TIMESTAMP\\(\\)' failed on master"), + ("Aborted connection"), + ("Client requested master to start replication from impossible position"), + ("Could not find first log file name in binary log"), + ("Enabling keys got errno"), + ("Error reading master configuration"), + ("Error reading packet"), + ("Event Scheduler"), + ("Failed to open log"), + ("Failed to open the existing master info file"), + ("Forcing shutdown of [0-9]* plugins"), + + /* + Due to timing issues, it might be that this warning + is printed when the server shuts down and the + computer is loaded. + */ + + ("Got error [0-9]* when reading table"), + ("Incorrect definition of table"), + ("Incorrect information in file"), + ("InnoDB: Warning: we did not need to do crash recovery"), + ("Invalid \\(old\\?\\) table or database name"), + ("Lock wait timeout exceeded"), + ("Log entry on master is longer than max_allowed_packet"), + ("unknown option '--loose-"), + ("unknown variable 'loose-"), + ("You have forced lower_case_table_names to 0 through a command-line option"), + ("Setting lower_case_table_names=2"), + ("NDB Binlog:"), + ("NDB: failed to setup table"), + ("NDB: only row based binary logging"), + ("Neither --relay-log nor --relay-log-index were used"), + ("Query partially completed"), + ("Slave I.O thread aborted while waiting for relay log"), + ("Slave SQL thread is stopped because UNTIL condition"), + ("Slave SQL thread retried transaction"), + ("Slave \\(additional info\\)"), + ("Slave: .*Duplicate column name"), + ("Slave: .*master may suffer from"), + ("Slave: According to the master's version"), + ("Slave: Column [0-9]* type mismatch"), + ("Slave: Error .* doesn't exist"), + ("Slave: Error .*Deadlock found"), + ("Slave: Error .*Unknown table"), + ("Slave: Error in Write_rows event: "), + ("Slave: Field .* of table .* has no default value"), + ("Slave: Field .* doesn't have a default value"), + ("Slave: Query caused different errors on master and slave"), + ("Slave: Table .* doesn't exist"), + ("Slave: Table width mismatch"), + ("Slave: The incident LOST_EVENTS occured on the master"), + ("Slave: Unknown error.* 1105"), + ("Slave: Can't drop database.* database doesn't exist"), + ("Slave SQL:.*(Error_code: \[\[:digit:\]\]+|Query:.*)"), + ("Sort aborted"), + ("Time-out in NDB"), + ("Warning:\s+One can only use the --user.*root"), + ("Warning:\s+Setting lower_case_table_names=2"), + ("Warning:\s+Table:.* on (delete|rename)"), + ("You have an error in your SQL syntax"), + ("deprecated"), + ("description of time zone"), + ("equal MySQL server ids"), + ("error .*connecting to master"), + ("error reading log entry"), + ("lower_case_table_names is set"), + ("skip-name-resolve mode"), + ("slave SQL thread aborted"), + ("Slave: .*Duplicate entry"), + + /* + Special case, made as specific as possible, for: + Bug #28436: Incorrect position in SHOW BINLOG EVENTS causes + server coredump + */ + + ("Error in Log_event::read_log_event\\\(\\\): 'Sanity check failed', data_len: 258, event_type: 49"), + + ("Statement is not safe to log in statement format"), + + /* test case for Bug#bug29807 copies a stray frm into database */ + ("InnoDB: Error: table `test`.`bug29807` does not exist in the InnoDB internal"), + ("Cannot find or open table test\/bug29807 from"), + + /* innodb foreign key tests that fail in ALTER or RENAME produce this */ + ("InnoDB: Error: in ALTER TABLE `test`.`t[12]`"), + ("InnoDB: Error: in RENAME TABLE table `test`.`t1`"), + ("InnoDB: Error: table `test`.`t[12]` does not exist in the InnoDB internal"), + + /* Test case for Bug#14233 produces the following warnings: */ + ("Stored routine 'test'.'bug14233_1': invalid value in column mysql.proc"), + ("Stored routine 'test'.'bug14233_2': invalid value in column mysql.proc"), + ("Stored routine 'test'.'bug14233_3': invalid value in column mysql.proc"), + + /* + BUG#32080 - Excessive warnings on Solaris: setrlimit could not + change the size of core files + */ + ("setrlimit could not change the size of core files to 'infinity'"), + + /* + rpl_extrColmaster_*.test, the slave thread produces warnings + when it get updates to a table that has more columns on the + master + */ + ("Slave: Unknown column 'c7' in 't15' Error_code: 1054"), + ("Slave: Can't DROP 'c7'.* 1091"), + ("Slave: Key column 'c6'.* 1072"), + + ("THE_LAST_SUPPRESSION")|| + + +-- +-- Procedure that uses the above created tables to check +-- the servers error log for warnings +-- +CREATE DEFINER=root@localhost PROCEDURE check_warnings() +BEGIN + -- + -- Load the server .err file into "error_log" table + -- + CREATE TEMPORARY TABLE error_log ( + row INT AUTO_INCREMENT PRIMARY KEY, + line mediumtext NULL + ); + + SELECT variable_value INTO @log_error + FROM information_schema.global_variables + WHERE variable_name='LOG_ERROR'; + + SET @text= load_file(@log_error); + -- select @text; + + WHILE LOCATE('\n', @text) DO + INSERT error_log (line) + VALUES ( + SUBSTR(@text, 1, LOCATE('\n', @text)-1) + ); + SET @text= SUBSTR(@text FROM LOCATE('\n', @text)+1); + END WHILE; + + -- select * from error_log; + + -- + -- Remove all lines belonging to previous tests + -- + SELECT COALESCE(MAX(row),0) INTO @max_row + FROM error_log + WHERE line REGEXP "^CURRENT_TEST:"; + DELETE FROM error_log WHERE row < @max_row; + + CREATE TEMPORARY TABLE suspect_lines AS + SELECT DISTINCT el.line, 0 as "supressed" + FROM error_log el, suspicious_patterns ep + WHERE el.line REGEXP ep.pattern; + + -- Mark lines that are supressed by global supressions + UPDATE suspect_lines sl, global_supressions gs + SET supressed=1 + WHERE sl.line REGEXP gs.pattern; + + -- Mark lines that are supressed by test specific supressions + UPDATE suspect_lines sl, test_supressions ts + SET supressed=2 + WHERE sl.line REGEXP ts.pattern; + + SELECT COUNT(*) INTO @num_warnings FROM suspect_lines + WHERE supressed=0; + + IF @num_warnings > 0 THEN + SELECT @log_error; + SELECT line as log_error + FROM suspect_lines WHERE supressed=0; + SELECT * FROM test_supressions; + ELSE + SELECT "OK"; + END IF; + + -- Cleanup for next test + TRUNCATE test_supressions; + +END|| + +-- +-- Declare a procedure testcases can use to insert test +-- specific supressions +-- +/*!50001 +CREATE DEFINER=root@localhost +PROCEDURE add_supression(pattern VARCHAR(255)) +BEGIN + INSERT INTO test_supressions (pattern) VALUES (pattern); +END +*/|| + + diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index a8b1fc6bc59..52eb84118b7 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -25,6 +25,7 @@ use base qw(Exporter); our @EXPORT= qw(collect_option collect_test_cases); use mtr_report; +use mtr_match; # Options used for the collect phase our $start_from; @@ -55,7 +56,6 @@ use IO::File(); use My::Config; use My::Platform; -require "mtr_match.pl"; require "mtr_misc.pl"; # Precompiled regex's for tests to do or skip @@ -425,7 +425,7 @@ sub collect_one_suite($) if (@combinations) { - print " - adding combinations\n"; + print " - adding combinations for $suite\n"; #print_testcases(@cases); my @new_cases; diff --git a/mysql-test/lib/mtr_match.pl b/mysql-test/lib/mtr_match.pm similarity index 87% rename from mysql-test/lib/mtr_match.pl rename to mysql-test/lib/mtr_match.pm index 96aa43f4fa2..40afd4e0336 100644 --- a/mysql-test/lib/mtr_match.pl +++ b/mysql-test/lib/mtr_match.pm @@ -18,20 +18,17 @@ # and is part of the translation of the Bourne shell script with the # same name. +package mtr_match; use strict; -sub mtr_match_prefix ($$); -sub mtr_match_extension ($$); -sub mtr_match_any_exact ($$); +use base qw(Exporter); +our @EXPORT= qw(mtr_match_prefix + mtr_match_extension + mtr_match_substring); -############################################################################## # -# -# -############################################################################## - # Match a prefix and return what is after the prefix - +# sub mtr_match_prefix ($$) { my $string= shift; my $prefix= shift; @@ -47,8 +44,9 @@ sub mtr_match_prefix ($$) { } +# # Match extension and return the name without extension - +# sub mtr_match_extension ($$) { my $file= shift; my $ext= shift; @@ -64,8 +62,9 @@ sub mtr_match_extension ($$) { } +# # Match a substring anywere in a string - +# sub mtr_match_substring ($$) { my $string= shift; my $substring= shift; diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm index 8b40177c5e0..a3c0f26c8fd 100644 --- a/mysql-test/lib/mtr_report.pm +++ b/mysql-test/lib/mtr_report.pm @@ -29,6 +29,7 @@ our @EXPORT= qw(report_option mtr_print_line mtr_print_thick_line mtr_report_test_failed mtr_report_test_skipped mtr_report_stats); +use mtr_match; require "mtr_io.pl"; my $tot_real_time= 0; @@ -115,7 +116,13 @@ sub mtr_report_test_failed ($$) { $tinfo->{'result'}= 'MTR_RES_FAILED'; my $test_failures= $tinfo->{'failures'} || 0; $tinfo->{'failures'}= $test_failures + 1; - if ( defined $tinfo->{'timeout'} ) + if ( defined $tinfo->{'warnings'} ) + { + mtr_report("[ fail ] Found warnings in server log file!"); + mtr_report($tinfo->{'warnings'}); + return; + } + elsif ( defined $tinfo->{'timeout'} ) { mtr_report("[ fail ] timeout"); return; @@ -161,7 +168,7 @@ sub mtr_report_stats ($) { my $tot_failed= 0; my $tot_tests= 0; my $tot_restarts= 0; - my $found_problems= 0; # Some warnings in the logfiles are errors... + my $found_problems= 0; foreach my $tinfo (@$tests) { @@ -183,6 +190,16 @@ sub mtr_report_stats ($) { { $tot_restarts++; } + + # Look for warnings produced by mysqltest + my $base_file= mtr_match_extension($tinfo->{'result_file'}, + "result"); # Trim extension + my $warning_file= "$base_file.warnings"; + if ( -f $warning_file ) + { + $found_problems= 1; + mtr_warning("Check myqltest warnings in '$warning_file'"); + } } # ---------------------------------------------------------------------- @@ -198,231 +215,12 @@ sub mtr_report_stats ($) { time - $BASETIME, "seconds executing testcases"); } - # ---------------------------------------------------------------------- - # If a debug run, there might be interesting information inside - # the "var/log/*.err" files. We save this info in "var/log/warnings" - # ---------------------------------------------------------------------- - if ( $::opt_warnings ) + my $warnlog= "$::opt_vardir/log/warnings"; + if ( -f $warnlog ) { - # Save and report if there was any fatal warnings/errors in err logs - - my $warnlog= "$::opt_vardir/log/warnings"; - - unless ( open(WARN, ">$warnlog") ) - { - mtr_warning("can't write to the file \"$warnlog\": $!"); - } - else - { - # We report different types of problems in order - foreach my $pattern ( "^Warning:", - "\\[Warning\\]", - "\\[ERROR\\]", - "^Error:", "^==.* at 0x", - "InnoDB: Warning", - "InnoDB: Error", - "^safe_mutex:", - "missing DBUG_RETURN", - "mysqld: Warning", - "allocated at line", - "Attempting backtrace", "Assertion .* failed" ) - { - foreach my $errlog ( sort glob("$::opt_vardir/log/*.err") ) - { - my $testname= ""; - unless ( open(ERR, $errlog) ) - { - mtr_warning("can't read $errlog"); - next; - } - my $leak_reports_expected= undef; - while ( ) - { - # There is a test case that purposely provokes a - # SAFEMALLOC leak report, even though there is no actual - # leak. We need to detect this, and ignore the warning in - # that case. - if (/Begin safemalloc memory dump:/) { - $leak_reports_expected= 1; - } elsif (/End safemalloc memory dump./) { - $leak_reports_expected= undef; - } - - # Skip some non fatal warnings from the log files - if ( - /\"SELECT UNIX_TIMESTAMP\(\)\" failed on master/ or - /Aborted connection/ or - /Client requested master to start replication from impossible position/ or - /Could not find first log file name in binary log/ or - /Enabling keys got errno/ or - /Error reading master configuration/ or - /Error reading packet/ or - /Event Scheduler/ or - /Failed to open log/ or - /Failed to open the existing master info file/ or - /Forcing shutdown of [0-9]* plugins/ or - /Can't open shared library .*\bha_example\b/ or - /Couldn't load plugin .*\bha_example\b/ or - - # Due to timing issues, it might be that this warning - # is printed when the server shuts down and the - # computer is loaded. - /Forcing close of thread \d+ user: '.*?'/ or - - /Got error [0-9]* when reading table/ or - /Incorrect definition of table/ or - /Incorrect information in file/ or - /InnoDB: Warning: we did not need to do crash recovery/ or - /Invalid \(old\?\) table or database name/ or - /Lock wait timeout exceeded/ or - /Log entry on master is longer than max_allowed_packet/ or - /unknown option '--loose-/ or - /unknown variable 'loose-/ or - /You have forced lower_case_table_names to 0 through a command-line option/ or - /Setting lower_case_table_names=2/ or - /NDB Binlog:/ or - /NDB: failed to setup table/ or - /NDB: only row based binary logging/ or - /Neither --relay-log nor --relay-log-index were used/ or - /Query partially completed/ or - /Slave I.O thread aborted while waiting for relay log/ or - /Slave SQL thread is stopped because UNTIL condition/ or - /Slave SQL thread retried transaction/ or - /Slave \(additional info\)/ or - /Slave: .*Duplicate column name/ or - /Slave: .*master may suffer from/ or - /Slave: According to the master's version/ or - /Slave: Column [0-9]* type mismatch/ or - /Slave: Error .* doesn't exist/ or - /Slave: Error .*Deadlock found/ or - /Slave: Error .*Unknown table/ or - /Slave: Error in Write_rows event: / or - /Slave: Field .* of table .* has no default value/ or - /Slave: Field .* doesn't have a default value/ or - /Slave: Query caused different errors on master and slave/ or - /Slave: Table .* doesn't exist/ or - /Slave: Table width mismatch/ or - /Slave: The incident LOST_EVENTS occured on the master/ or - /Slave: Unknown error.* 1105/ or - /Slave: Can't drop database.* database doesn't exist/ or - /Slave SQL:.*(?:Error_code: \d+|Query:.*)/ or - /Sort aborted/ or - /Time-out in NDB/ or - /One can only use the --user.*root/ or - /Setting lower_case_table_names=2/ or - /Table:.* on (delete|rename)/ or - /You have an error in your SQL syntax/ or - /deprecated/ or - /description of time zone/ or - /equal MySQL server ids/ or - /error .*connecting to master/ or - /error reading log entry/ or - /lower_case_table_names is set/ or - /skip-name-resolve mode/ or - /slave SQL thread aborted/ or - /Slave: .*Duplicate entry/ or - # Special case for Bug #26402 in show_check.test - # Question marks are not valid file name parts - # on Windows platforms. Ignore this error message. - /\QCan't find file: '.\test\????????.frm'\E/ or - # Special case, made as specific as possible, for: - # Bug #28436: Incorrect position in SHOW BINLOG EVENTS causes - # server coredump - /\QError in Log_event::read_log_event(): 'Sanity check failed', data_len: 258, event_type: 49\E/ or - /Statement is not safe to log in statement format/ or - - # test case for Bug#bug29807 copies a stray frm into database - /InnoDB: Error: table `test`.`bug29807` does not exist in the InnoDB internal/ or - /Cannot find or open table test\/bug29807 from/ or - - # innodb foreign key tests that fail in ALTER or RENAME produce this - /InnoDB: Error: in ALTER TABLE `test`.`t[12]`/ or - /InnoDB: Error: in RENAME TABLE table `test`.`t1`/ or - /InnoDB: Error: table `test`.`t[12]` does not exist in the InnoDB internal/ or - - # Test case for Bug#14233 produces the following warnings: - /Stored routine 'test'.'bug14233_1': invalid value in column mysql.proc/ or - /Stored routine 'test'.'bug14233_2': invalid value in column mysql.proc/ or - /Stored routine 'test'.'bug14233_3': invalid value in column mysql.proc/ or - - # BUG#29839 - lowercase_table3.test: Cannot find table test/T1 - # from the internal data dictiona - /Cannot find table test\/BUG29839 from the internal data dictionary/ or - # BUG#32080 - Excessive warnings on Solaris: setrlimit could not - # change the size of core files - /setrlimit could not change the size of core files to 'infinity'/ or - - # rpl_extrColmaster_*.test, the slave thread produces warnings - # when it get updates to a table that has more columns on the - # master - /Slave: Unknown column 'c7' in 't15' Error_code: 1054/ or - /Slave: Can't DROP 'c7'.* 1091/ or - /Slave: Key column 'c6'.* 1072/ or - - # rpl_idempotency.test produces warnings for the slave. - ($testname eq 'rpl.rpl_idempotency' and - (/Slave: Can\'t find record in \'t1\' Error_code: 1032/ or - /Slave: Cannot add or update a child row: a foreign key constraint fails .* Error_code: 1452/ - )) or - - # These tests does "kill" on queries, causing sporadic errors when writing to logs - (($testname eq 'rpl.rpl_skip_error' or - $testname eq 'rpl.rpl_err_ignoredtable' or - $testname eq 'binlog.binlog_killed_simulate' or - $testname eq 'binlog.binlog_killed') and - (/Failed to write to mysql\.\w+_log/ - )) or - - # rpl_bug33931 has deliberate failures - ($testname eq 'rpl.rpl_bug33931' and - (/Failed during slave.*thread initialization/ - )) or - - # rpl_temporary has an error on slave that can be ignored - ($testname eq 'rpl.rpl_temporary' and - (/Slave: Can\'t find record in \'user\' Error_code: 1032/ - )) or - - # Test case for Bug#31590 produces the following error: - /Out of sort memory; increase server sort buffer size/ - ) - { - next; # Skip these lines - } - if ( /CURRENT_TEST: (.*)/ ) - { - $testname= $1; - } - if ( /$pattern/ ) - { - if ($leak_reports_expected) { - next; - } - $found_problems= 1; - print WARN basename($errlog) . ": $testname: $_"; - } - } - } - } - - if ( $::opt_check_testcases ) - { - # Look for warnings produced by mysqltest in testname.warnings - foreach my $test_warning_file - ( glob("$::glob_mysql_test_dir/r/*.warnings") ) - { - $found_problems= 1; - print WARN "Check myqltest warnings in $test_warning_file\n"; - } - } - - if ( $found_problems ) - { - mtr_warning("Got errors/warnings while running tests, please examine", - "\"$warnlog\" for details."); - } - } + mtr_warning("Got errors/warnings while running tests, please examine", + "'$warnlog' for details."); } print "\n"; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index d0d7a761107..4afb4e34d76 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -11,7 +11,6 @@ # See the "MySQL Test framework manual" for more information # http://dev.mysql.com/doc/mysqltest/en/index.html # -# Please keep the test framework tools identical in all versions! # ############################################################################## @@ -51,11 +50,11 @@ use My::Options; use My::Find; use mtr_cases; use mtr_report; +use mtr_match; require "lib/mtr_process.pl"; require "lib/mtr_io.pl"; require "lib/mtr_gcov.pl"; -require "lib/mtr_match.pl"; require "lib/mtr_misc.pl"; require "lib/mtr_unique.pl"; @@ -330,7 +329,7 @@ sub command_line_setup { # Test case authoring 'record' => \$opt_record, - 'check-testcases' => \$opt_check_testcases, + 'check-testcases!' => \$opt_check_testcases, 'mark-progress' => \$opt_mark_progress, # Extra options used when starting mysqld @@ -1984,17 +1983,48 @@ sub initialize_servers { # -# Copy the reference database into selected datadir +# Remove all newline characters expect after semicolon # -sub copy_install_db ($) { - my $path_data_dir= shift; +sub sql_to_bootstrap { + my ($sql) = @_; + my @lines= split(/\n/, $sql); + my $result= "\n"; + my $delimiter= ';'; - # Don't install over another db - mtr_error("There is already an installed db in '$path_data_dir'") - if -d $path_data_dir; + foreach my $line (@lines) { - # copy the installed db into place - copytree("$opt_vardir/install.db", $path_data_dir); + # Change current delimiter if line starts with "delimiter" + if ( $line =~ /^delimiter (.*)/ ) { + my $new= $1; + # Remove old delimiter from end of new + $new=~ s/\Q$delimiter\E$//; + $delimiter = $new; + mtr_debug("changed delimiter to $delimiter"); + # No need to add the delimiter to result + next; + } + + # Add newline if line ends with $delimiter + # and convert the current delimiter to semicolon + if ( $line =~ /\Q$delimiter\E$/ ){ + $line =~ s/\Q$delimiter\E$/;/; + $result.= "$line\n"; + mtr_debug("Added default delimiter"); + next; + } + + # Remove comments starting with -- + if ( $line =~ /^\s*--/ ) { + mtr_debug("Discarded $line"); + next; + } + + # Default, just add the line without newline + # but with a space as separator + $result.= "$line "; + + } + return $result; } @@ -2073,6 +2103,10 @@ sub mysql_install_db { mtr_tofile($bootstrap_sql_file, "CREATE DATABASE mtr;\n"); + # Add help tables and data for warning detection and supression + mtr_tofile($bootstrap_sql_file, + sql_to_bootstrap(mtr_grab_file("include/mtr_warnings.sql"))); + # Log bootstrap command my $path_bootstrap_log= "$opt_vardir/log/bootstrap.log"; mtr_tofile($path_bootstrap_log, @@ -2169,11 +2203,12 @@ sub do_before_run_mysqltest($) } -sub run_check_testcase_all($$) +sub check_testcase($$) { my ($tinfo, $mode)= @_; my $result; + # Parallell( mysqlds(), run_check_testcase, check_testcase_failed ); foreach my $mysqld ( mysqlds() ) { if ( defined $mysqld->{'proc'} ) @@ -2352,7 +2387,7 @@ sub run_testcase ($) { if ( $opt_check_testcases ) { - run_check_testcase_all($tinfo, "before") + check_testcase($tinfo, "before") } my $test= start_mysqltest($tinfo); @@ -2380,11 +2415,20 @@ sub run_testcase ($) { if ( $res == 0 ) { - mtr_report_test_passed($tinfo, $opt_timer); + if ( $opt_warnings and check_warnings($tinfo) ) + { + # Found unexpected warnings + report_failure_and_restart($tinfo); + $res= 1; + } + else + { + mtr_report_test_passed($tinfo, $opt_timer); + } if ( $opt_check_testcases ) { - if (run_check_testcase_all($tinfo, "after")) + if (check_testcase($tinfo, "after")) { # Stop all servers that are known to be running stop_all_servers(); @@ -2484,6 +2528,93 @@ sub run_testcase ($) { } +# Run include/check-warnings.test +# +# RETURN VALUE +# 0 OK +# 1 Check failed +# +sub run_check_warnings ($$) { + my $tinfo= shift; + my $mysqld= shift; + + my $name= "warnings-".$mysqld->name(); + my $tname= $tinfo->{name}; + + my $args; + mtr_init_args(\$args); + + mtr_add_arg($args, "--defaults-file=%s", $path_config_file); + mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld')); + + mtr_add_arg($args, "--silent"); + mtr_add_arg($args, "--skip-safemalloc"); + mtr_add_arg($args, "--test-file=%s", "include/check-warnings.test"); + + my $errfile= "$opt_vardir/tmp/$name.err"; + my $res= My::SafeProcess->run + ( + name => $name, + path => $exe_mysqltest, + error => $errfile, + output => $errfile, + args => \$args, + ); + + if ( $res == 0 ) + { + my $report= mtr_grab_file($errfile); + if ($report ne "OK\nOK\n") + { + # Log to var/log/warnings file + mtr_tofile("$opt_vardir/log/warnings", + $tname."\n", + $report); + + $res= 1; + $tinfo->{'warnings'}.= $report; + + } + } + elsif ( $res == 62 ) + { + # One of the features needed to run check_warnings.test was not + # available, check skipped + $res= 0; + } + elsif ( $res ) + { + mtr_report("\nCould not execute 'check-warnings' for testcase '$tname':"); + mtr_printfile($errfile); + $res= 0; # Ignore error + } + return $res; +} + + +# +# Loop through our list of processes and check the error log +# for unexepcted errors and warnings +# +sub check_warnings ($) { + my ($tinfo)= @_; + my $res= 0; + + # Clear previous warnings + $tinfo->{warnings}= undef; + + # Parallell( mysqlds(), run_check_warning, check_warning_failed); + foreach my $mysqld ( mysqlds() ) + { + if (run_check_warnings($tinfo, $mysqld)){ + $res= 1; + mtr_report(); + } + } + return $res; +} + + # # Loop through our list of processes and look for and entry # with the provided pid, if found check for the file indicating @@ -2568,6 +2699,11 @@ sub after_test_failure ($) { mtr_debug("Removing '$backup_dir'"); } } + + # Remove all files in var/tmp + rmtree($opt_tmpdir); + mkpath($opt_tmpdir); + } @@ -3064,7 +3200,8 @@ sub start_servers($) { } # Copy datadir from installed system db - copy_install_db($datadir) unless -d $datadir; + copytree("$opt_vardir/install.db", $datadir) + unless -d $datadir; # Write start of testcase to log file mark_log($mysqld->value('log-error'), $tinfo); @@ -3144,17 +3281,11 @@ sub run_check_testcase ($$$) { my $args; mtr_init_args(\$args); - mtr_add_arg($args, "--no-defaults"); + mtr_add_arg($args, "--defaults-file=%s", $path_config_file); + mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld')); + mtr_add_arg($args, "--silent"); mtr_add_arg($args, "--skip-safemalloc"); - mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir); - mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir); - - mtr_add_arg($args, "--socket=%s", $mysqld->value('socket')); - mtr_add_arg($args, "--port=%d", $mysqld->value('port')); - mtr_add_arg($args, "--database=test"); - mtr_add_arg($args, "--user=%s", $opt_user); - mtr_add_arg($args, "--password="); mtr_add_arg($args, "--result-file=%s", "$opt_vardir/tmp/$name.result"); mtr_add_arg($args, "--test-file=%s", "include/check-testcase.test"); @@ -3177,12 +3308,12 @@ sub run_check_testcase ($$$) { mtr_report("\nThe check of testcase '$tname' failed, this is the\n", "diff between before and after:\n"); # Test failed, display the report mysqltest has created - mtr_printfile("$opt_vardir/tmp/$name.err"); + mtr_printfile($errfile); } elsif ( $res ) { mtr_report("\nCould not execute 'check-testcase' $mode testcase '$tname':"); - mtr_printfile("$opt_vardir/tmp/$name.err"); + mtr_printfile($errfile); mtr_report(); } return $res; diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 5e9e5c6f31c..980e539534a 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -36,7 +36,11 @@ create table t3(a int, KEY a_data (a)); create table mysqltest.t4(a int); create table t5 (id int auto_increment primary key); insert into t5 values (10); -create view v1 (c) as select table_name from information_schema.TABLES where table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status'; +create view v1 (c) as +SELECT table_name FROM information_schema.TABLES +WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND +table_name<>'ndb_binlog_index' AND +table_name<>'ndb_apply_status'; select * from v1; c CHARACTER_SETS @@ -272,19 +276,19 @@ select * from t1; select * from t2; end| select parameter_style, sql_data_access, dtd_identifier -from information_schema.routines; +from information_schema.routines where routine_schema='test'; parameter_style sql_data_access dtd_identifier SQL CONTAINS SQL NULL SQL CONTAINS SQL int(11) -show procedure status; +show procedure status where db='test'; Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation test sel2 PROCEDURE root@localhost # # DEFINER latin1 latin1_swedish_ci latin1_swedish_ci -show function status; +show function status where db='test'; Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation test sub1 FUNCTION root@localhost # # DEFINER latin1 latin1_swedish_ci latin1_swedish_ci select a.ROUTINE_NAME from information_schema.ROUTINES a, information_schema.SCHEMATA b where -a.ROUTINE_SCHEMA = b.SCHEMA_NAME; +a.ROUTINE_SCHEMA = b.SCHEMA_NAME AND b.SCHEMA_NAME='test'; ROUTINE_NAME sel2 sub1 @@ -295,14 +299,14 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE # ALL NULL NULL NULL NULL NULL 1 SIMPLE # ALL NULL NULL NULL NULL NULL Using where; Using join buffer select a.ROUTINE_NAME, b.name from information_schema.ROUTINES a, -mysql.proc b where a.ROUTINE_NAME = convert(b.name using utf8) order by 1; +mysql.proc b where a.ROUTINE_NAME = convert(b.name using utf8) AND a.ROUTINE_SCHEMA='test' order by 1; ROUTINE_NAME name sel2 sel2 sub1 sub1 -select count(*) from information_schema.ROUTINES; +select count(*) from information_schema.ROUTINES where routine_schema='test'; count(*) 2 -create view v1 as select routine_schema, routine_name from information_schema.routines +create view v1 as select routine_schema, routine_name from information_schema.routines where routine_schema='test' order by routine_schema, routine_name; select * from v1; routine_schema routine_name @@ -850,7 +854,7 @@ VIEWS TABLE_NAME select delete from mysql.user where user='mysqltest_4'; delete from mysql.db where user='mysqltest_4'; flush privileges; -SELECT table_schema, count(*) FROM information_schema.TABLES where table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA; +SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA; table_schema count(*) information_schema 28 mysql 22 @@ -890,7 +894,7 @@ if new.j = -1 then set @fired:= "Yes"; end if; end AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci -select * from information_schema.triggers; +select * from information_schema.triggers where trigger_schema in ('mysql', 'information_schema', 'test', 'mysqltest'); TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION NULL test trg1 INSERT NULL test t1 0 NULL begin if new.j > 10 then @@ -1079,7 +1083,7 @@ BEGIN SELECT 'foo' FROM DUAL; END | ERROR 42000: Unknown database 'information_schema' -select ROUTINE_NAME from routines; +select ROUTINE_NAME from routines where ROUTINE_SCHEMA='information_schema'; ROUTINE_NAME grant all on information_schema.* to 'user1'@'localhost'; ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' @@ -1161,7 +1165,7 @@ use mysql; INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL', 'NO','DEFINER','','','BEGIN\r\n \r\nEND','root@%','2006-03-02 18:40:03', '2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a'); -select routine_name from information_schema.routines; +select routine_name from information_schema.routines where ROUTINE_SCHEMA='test'; routine_name delete from proc where name=''; @@ -1195,7 +1199,7 @@ CREATE FUNCTION f1() RETURNS INT RETURN @a + 1; CREATE USER mysql_bug20230@localhost; GRANT EXECUTE ON PROCEDURE p1 TO mysql_bug20230@localhost; GRANT EXECUTE ON FUNCTION f1 TO mysql_bug20230@localhost; -SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES; +SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA='test'; ROUTINE_NAME ROUTINE_DEFINITION f1 RETURN @a + 1 p1 SET @a= 1 @@ -1207,7 +1211,7 @@ SHOW CREATE FUNCTION f1; Function sql_mode Create Function character_set_client collation_connection Database Collation f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) RETURN @a + 1 latin1 latin1_swedish_ci latin1_swedish_ci -SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES; +SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA='test'; ROUTINE_NAME ROUTINE_DEFINITION f1 NULL p1 NULL @@ -1310,12 +1314,12 @@ TABLE_PRIVILEGES TABLE_SCHEMA TRIGGERS TRIGGER_SCHEMA USER_PRIVILEGES GRANTEE VIEWS TABLE_SCHEMA -SELECT MAX(table_name) FROM information_schema.tables; +SELECT MAX(table_name) FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test'); MAX(table_name) VIEWS SELECT table_name from information_schema.tables WHERE table_name=(SELECT MAX(table_name) -FROM information_schema.tables); +FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test')); table_name VIEWS DROP TABLE IF EXISTS bug23037; diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result index 31846f68b7b..8f4c311a7a7 100644 --- a/mysql-test/r/mysql_upgrade.result +++ b/mysql-test/r/mysql_upgrade.result @@ -1,4 +1,7 @@ Run mysql_upgrade once +mtr.global_supressions OK +mtr.suspicious_patterns OK +mtr.test_supressions OK mysql.columns_priv OK mysql.db OK mysql.event OK @@ -29,6 +32,9 @@ mysql.user OK Run it again - should say already completed This installation of MySQL is already upgraded to VERSION, use --force if you still need to run mysql_upgrade Force should run it regardless of wether it's been run before +mtr.global_supressions OK +mtr.suspicious_patterns OK +mtr.test_supressions OK mysql.columns_priv OK mysql.db OK mysql.event OK @@ -59,6 +65,9 @@ mysql.user OK CREATE USER mysqltest1@'%' IDENTIFIED by 'sakila'; GRANT ALL ON *.* TO mysqltest1@'%'; Run mysql_upgrade with password protected account +mtr.global_supressions OK +mtr.suspicious_patterns OK +mtr.test_supressions OK mysql.columns_priv OK mysql.db OK mysql.event OK @@ -91,6 +100,9 @@ Run mysql_upgrade with a non existing server socket mysqlcheck: Got error: 2005: Unknown MySQL server host 'not_existing_host' (errno) when trying to connect FATAL ERROR: Upgrade failed set GLOBAL sql_mode='STRICT_ALL_TABLES,ANSI_QUOTES,NO_ZERO_DATE'; +mtr.global_supressions OK +mtr.suspicious_patterns OK +mtr.test_supressions OK mysql.columns_priv OK mysql.db OK mysql.event OK diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result index b8fdd04d24a..8a819496eeb 100644 --- a/mysql-test/r/mysqlcheck.result +++ b/mysql-test/r/mysqlcheck.result @@ -1,6 +1,9 @@ DROP TABLE IF EXISTS t1, `t``1`, `t 1`; drop view if exists v1; drop database if exists client_test_db; +mtr.global_supressions OK +mtr.suspicious_patterns OK +mtr.test_supressions OK mysql.columns_priv OK mysql.db OK mysql.event OK diff --git a/mysql-test/r/sp-destruct.result b/mysql-test/r/sp-destruct.result index ae294f05b25..d7d44061b76 100644 --- a/mysql-test/r/sp-destruct.result +++ b/mysql-test/r/sp-destruct.result @@ -84,7 +84,7 @@ drop table t1; drop function bug14233_1; drop function bug14233_2; drop procedure bug14233_3; -show procedure status; +show procedure status where db=DATABASE(); Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation -show function status; +show function status where db=DATABASE(); Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index 5ac61821cea..de3ec91b632 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -1,4 +1,5 @@ drop table if exists t1, t2; +SELECT * FROM mysql.proc INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/proc.txt'; delete from mysql.proc; create procedure syntaxerror(t int)| ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 @@ -1650,3 +1651,4 @@ begin declare continue handler for sqlstate '00000' set @x=0; end$$ ERROR 42000: Bad SQLSTATE: '00000' +LOAD DATA INFILE '../../tmp/proc.txt' INTO TABLE mysql.proc; diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result index cf26f0076d7..66177395ac9 100644 --- a/mysql-test/r/sp-security.result +++ b/mysql-test/r/sp-security.result @@ -142,13 +142,13 @@ use db2; alter procedure q modifies sql data; drop procedure q; use test; -select type,db,name from mysql.proc; +select type,db,name from mysql.proc where db like 'db%'; type db name FUNCTION db1_secret db PROCEDURE db1_secret stamp drop database db1_secret; drop database db2; -select type,db,name from mysql.proc; +select type,db,name from mysql.proc where db like 'db%'; type db name delete from mysql.user where user='user1' or user='user2'; delete from mysql.user where user='' and host='%'; diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 768e0cc07a5..ab6f5c27db3 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -1322,7 +1322,7 @@ end; end if; end loop; end latin1 latin1_swedish_ci latin1_swedish_ci -show procedure status like '%p%'| +show procedure status where name like '%p%' and db='test'| Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation test ip PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci test opp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci @@ -1335,7 +1335,7 @@ i p drop table t3| drop procedure opp| drop procedure ip| -show procedure status like '%p%'| +show procedure status where name like '%p%' and db='test'| Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation drop table if exists t3| create table t3 ( f bigint unsigned not null )| @@ -1945,12 +1945,12 @@ drop procedure bug2260| drop procedure if exists bug2267_1| create procedure bug2267_1() begin -show procedure status; +show procedure status where db='test'; end| drop procedure if exists bug2267_2| create procedure bug2267_2() begin -show function status; +show function status where db='test'; end| drop procedure if exists bug2267_3| create procedure bug2267_3() @@ -1977,7 +1977,7 @@ call bug2267_3()| Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation bug2267_1 CREATE DEFINER=`root`@`localhost` PROCEDURE `bug2267_1`() begin -show procedure status; +show procedure status where db='test'; end latin1 latin1_swedish_ci latin1_swedish_ci call bug2267_4()| Function sql_mode Create Function character_set_client collation_connection Database Collation diff --git a/mysql-test/suite/rpl/r/rpl_bug33931.result b/mysql-test/suite/rpl/r/rpl_bug33931.result index 4043f04215b..6c3c3f550dc 100644 --- a/mysql-test/suite/rpl/r/rpl_bug33931.result +++ b/mysql-test/suite/rpl/r/rpl_bug33931.result @@ -1,6 +1,8 @@ reset master; +call mtr.add_supression("Failed during slave.*thread initialization"); stop slave; reset slave; +SET GLOBAL debug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init"; start slave; show slave status; Slave_IO_State # diff --git a/mysql-test/suite/rpl/r/rpl_idempotency.result b/mysql-test/suite/rpl/r/rpl_idempotency.result index 5a4052864ad..f02ff899ad5 100644 --- a/mysql-test/suite/rpl/r/rpl_idempotency.result +++ b/mysql-test/suite/rpl/r/rpl_idempotency.result @@ -4,6 +4,8 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +call mtr.add_supression("Slave: Can\'t find record in \'t1\' Error_code: 1032"); +call mtr.add_supression("Slave: Cannot add or update a child row: a foreign key constraint fails .* Error_code: 1452"); CREATE TABLE t1 (a INT PRIMARY KEY); CREATE TABLE t2 (a INT); INSERT INTO t1 VALUES (-1),(-2),(-3); diff --git a/mysql-test/suite/rpl/t/rpl_bug33931-slave.opt b/mysql-test/suite/rpl/t/rpl_bug33931-slave.opt deleted file mode 100644 index 55fe328a41d..00000000000 --- a/mysql-test/suite/rpl/t/rpl_bug33931-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-debug=d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init diff --git a/mysql-test/suite/rpl/t/rpl_bug33931.test b/mysql-test/suite/rpl/t/rpl_bug33931.test index 788f79d4c1c..8b788f62f23 100644 --- a/mysql-test/suite/rpl/t/rpl_bug33931.test +++ b/mysql-test/suite/rpl/t/rpl_bug33931.test @@ -13,10 +13,18 @@ connection master; reset master; connection slave; + +# Add supression for expected warnings in slaves error log +call mtr.add_supression("Failed during slave.*thread initialization"); + --disable_warnings stop slave; --enable_warnings reset slave; + +# Set debug flags on slave to force errors to occur +SET GLOBAL debug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init"; + start slave; connection master; diff --git a/mysql-test/suite/rpl/t/rpl_idempotency.test b/mysql-test/suite/rpl/t/rpl_idempotency.test index cec91a6f4b7..0dc687a8656 100644 --- a/mysql-test/suite/rpl/t/rpl_idempotency.test +++ b/mysql-test/suite/rpl/t/rpl_idempotency.test @@ -7,6 +7,10 @@ source include/have_innodb.inc; connection slave; source include/have_innodb.inc; +# Add supression for expected warning(s) in slaves error log +call mtr.add_supression("Slave: Can\'t find record in \'t1\' Error_code: 1032"); +call mtr.add_supression("Slave: Cannot add or update a child row: a foreign key constraint fails .* Error_code: 1452"); + connection master; CREATE TABLE t1 (a INT PRIMARY KEY); CREATE TABLE t2 (a INT); @@ -393,15 +397,13 @@ sync_slave_with_master; #connection slave; set global slave_exec_mode='STRICT'; - # cleanup for bug#31609 tests connection master; set @@session.binlog_format= @save_binlog_format; drop table t1,t2,ti2,ti1; -sync_slave_with_master; - +--source include/master-slave-end.inc --echo *** end of tests diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index bb9cb127d07..699d3af6709 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -37,7 +37,11 @@ create table t3(a int, KEY a_data (a)); create table mysqltest.t4(a int); create table t5 (id int auto_increment primary key); insert into t5 values (10); -create view v1 (c) as select table_name from information_schema.TABLES where table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status'; +create view v1 (c) as + SELECT table_name FROM information_schema.TABLES + WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND + table_name<>'ndb_binlog_index' AND + table_name<>'ndb_apply_status'; select * from v1; select c,table_name from v1 @@ -133,25 +137,25 @@ delimiter ;| # Bug#7222 information_schema: errors in "routines" # select parameter_style, sql_data_access, dtd_identifier -from information_schema.routines; +from information_schema.routines where routine_schema='test'; --replace_column 5 # 6 # -show procedure status; +show procedure status where db='test'; --replace_column 5 # 6 # -show function status; +show function status where db='test'; select a.ROUTINE_NAME from information_schema.ROUTINES a, information_schema.SCHEMATA b where -a.ROUTINE_SCHEMA = b.SCHEMA_NAME; +a.ROUTINE_SCHEMA = b.SCHEMA_NAME AND b.SCHEMA_NAME='test'; --replace_column 3 # explain select a.ROUTINE_NAME from information_schema.ROUTINES a, information_schema.SCHEMATA b where a.ROUTINE_SCHEMA = b.SCHEMA_NAME; select a.ROUTINE_NAME, b.name from information_schema.ROUTINES a, -mysql.proc b where a.ROUTINE_NAME = convert(b.name using utf8) order by 1; -select count(*) from information_schema.ROUTINES; +mysql.proc b where a.ROUTINE_NAME = convert(b.name using utf8) AND a.ROUTINE_SCHEMA='test' order by 1; +select count(*) from information_schema.ROUTINES where routine_schema='test'; -create view v1 as select routine_schema, routine_name from information_schema.routines +create view v1 as select routine_schema, routine_name from information_schema.routines where routine_schema='test' order by routine_schema, routine_name; select * from v1; drop view v1; @@ -528,7 +532,7 @@ flush privileges; # Bug #9404 information_schema: Weird error messages # with SELECT SUM() ... GROUP BY queries # -SELECT table_schema, count(*) FROM information_schema.TABLES where table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA; +SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA; # @@ -557,7 +561,7 @@ begin end| delimiter ;| show triggers; -select * from information_schema.triggers; +select * from information_schema.triggers where trigger_schema in ('mysql', 'information_schema', 'test', 'mysqltest'); drop trigger trg1; drop trigger trg2; @@ -727,7 +731,7 @@ BEGIN SELECT 'foo' FROM DUAL; END | delimiter ;| -select ROUTINE_NAME from routines; +select ROUTINE_NAME from routines where ROUTINE_SCHEMA='information_schema'; # # Bug #10734 Grant of privileges other than 'select' and 'create view' should fail on schema # @@ -827,7 +831,7 @@ use mysql; INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL', 'NO','DEFINER','','','BEGIN\r\n \r\nEND','root@%','2006-03-02 18:40:03', '2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a'); -select routine_name from information_schema.routines; +select routine_name from information_schema.routines where ROUTINE_SCHEMA='test'; delete from proc where name=''; use test; @@ -874,13 +878,13 @@ CREATE USER mysql_bug20230@localhost; GRANT EXECUTE ON PROCEDURE p1 TO mysql_bug20230@localhost; GRANT EXECUTE ON FUNCTION f1 TO mysql_bug20230@localhost; -SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES; +SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA='test'; SHOW CREATE PROCEDURE p1; SHOW CREATE FUNCTION f1; connect (conn1, localhost, mysql_bug20230,,); -SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES; +SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA='test'; SHOW CREATE PROCEDURE p1; SHOW CREATE FUNCTION f1; CALL p1(); @@ -931,10 +935,10 @@ SELECT t.table_name, c1.column_name # INFORMARTION_SCHEMA.TABLES # -SELECT MAX(table_name) FROM information_schema.tables; +SELECT MAX(table_name) FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test'); SELECT table_name from information_schema.tables WHERE table_name=(SELECT MAX(table_name) - FROM information_schema.tables); + FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test')); # # Bug #23037: Bug in field "Default" of query "SHOW COLUMNS FROM table" # diff --git a/mysql-test/t/sp-destruct.test b/mysql-test/t/sp-destruct.test index ae2bb9f7ea3..14c38a2fdb4 100644 --- a/mysql-test/t/sp-destruct.test +++ b/mysql-test/t/sp-destruct.test @@ -153,5 +153,5 @@ drop function bug14233_1; drop function bug14233_2; drop procedure bug14233_3; # Assert: These should show nothing. -show procedure status; -show function status; +show procedure status where db=DATABASE(); +show function status where db=DATABASE(); diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index 6896a1ab832..1faa524f8d3 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -6,6 +6,10 @@ drop table if exists t1, t2; --enable_warnings +# Backup the mysql.proc table +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval SELECT * FROM mysql.proc INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/proc.txt'; + # Make sure we don't have any procedures left. delete from mysql.proc; @@ -2421,3 +2425,9 @@ delimiter ;$$ #--enable_warnings #create procedure bugNNNN... #create function bugNNNN... + +# +# CLEANUP and RESTORE +# +LOAD DATA INFILE '../../tmp/proc.txt' INTO TABLE mysql.proc; +remove_file $MYSQLTEST_VARDIR/tmp/proc.txt; diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test index 91de14116d4..b372c05b6e3 100644 --- a/mysql-test/t/sp-security.test +++ b/mysql-test/t/sp-security.test @@ -243,11 +243,11 @@ disconnect con2user1; disconnect con3anon; disconnect con4user2; use test; -select type,db,name from mysql.proc; +select type,db,name from mysql.proc where db like 'db%'; drop database db1_secret; drop database db2; # Make sure the routines are gone -select type,db,name from mysql.proc; +select type,db,name from mysql.proc where db like 'db%'; # Get rid of the users delete from mysql.user where user='user1' or user='user2'; delete from mysql.user where user='' and host='%'; diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 464530bec00..ac90217f891 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -1540,7 +1540,7 @@ begin end| show create procedure opp| --replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00' -show procedure status like '%p%'| +show procedure status where name like '%p%' and db='test'| # This isn't the fastest way in the world to compute prime numbers, so # don't be too ambitious. ;-) @@ -1558,7 +1558,7 @@ drop table t3| drop procedure opp| drop procedure ip| --replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00' -show procedure status like '%p%'| +show procedure status where name like '%p%' and db='test'| # Fibonacci, for recursion test. (Yet Another Numerical series :) @@ -2280,7 +2280,7 @@ drop procedure if exists bug2267_1| --enable_warnings create procedure bug2267_1() begin - show procedure status; + show procedure status where db='test'; end| --disable_warnings @@ -2288,7 +2288,7 @@ drop procedure if exists bug2267_2| --enable_warnings create procedure bug2267_2() begin - show function status; + show function status where db='test'; end| --disable_warnings