From 1bee5903474aeac60171c64142ce402b3f695c4e Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Wed, 7 Apr 2010 01:47:08 +0300 Subject: [PATCH 1/3] Removed compiler warnings Removed random failures from test suite mysql-test/extra/rpl_tests/rpl_insert_id_pk.test: Make test predicatable. mysql-test/include/maria_empty_logs.inc: We can't use 'Threads_connected' for syncronization, as the 'check_warnings' thread that just quit may still be counted in 'Threads_connected' Now we just wait until MySQLD answers again, which should be good enough for our purposes mysql-test/suite/binlog/r/binlog_index.result: Updated results file mysql-test/suite/binlog/t/binlog_index-master.opt: Added option file to not get stack traces in .err file. mysql-test/suite/binlog/t/binlog_index.test: Added 'flush tables' to remove warning about crashed suppression file from logs mysql-test/suite/pbxt/r/multi_statement.result: Updated results mysql-test/suite/pbxt/t/multi_statement-master.opt: Added options so that slow query testing makes sense sql/events.cc: Don't write Event Scheduler startup message if warnings are turned off. sql/handler.cc: Removed compiler warning sql/log.cc: Removed compiler warning sql/mysqld.cc: Added option 'test-expect-abort'; If this is set, we don't write message to log in case of 'DBUG_ABORT'. (Gives us smaller, easier to read log files) sql/set_var.cc: Removed compiler warning sql/slave.cc: Removed compiler warning sql/sql_plugin.cc: Don't write warnings about disabled plugin if using --log_warnings=0 storage/xtradb/include/ut0lst.h: Removed compiler warning support-files/compiler_warnings.supp: Supress warning from xtradb --- .../extra/rpl_tests/rpl_insert_id_pk.test | 3 +-- mysql-test/include/maria_empty_logs.inc | 14 +++++++---- mysql-test/suite/binlog/r/binlog_index.result | 1 + .../suite/binlog/t/binlog_index-master.opt | 1 + mysql-test/suite/binlog/t/binlog_index.test | 2 ++ .../suite/pbxt/r/multi_statement.result | 2 +- .../suite/pbxt/t/multi_statement-master.opt | 3 +++ sql/events.cc | 5 ++-- sql/handler.cc | 2 ++ sql/log.cc | 1 + sql/mysqld.cc | 24 ++++++++++++++----- sql/set_var.cc | 6 ++--- sql/slave.cc | 1 + sql/sql_plugin.cc | 7 +++--- storage/xtradb/include/ut0lst.h | 2 +- support-files/compiler_warnings.supp | 1 + 16 files changed, 52 insertions(+), 23 deletions(-) create mode 100644 mysql-test/suite/binlog/t/binlog_index-master.opt create mode 100644 mysql-test/suite/pbxt/t/multi_statement-master.opt diff --git a/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test b/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test index 844f93d0906..0be33a46c04 100644 --- a/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test +++ b/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test @@ -82,7 +82,6 @@ SET FOREIGN_KEY_CHECKS=0; # Duplicate Key Errors codes --error 1022, ER_DUP_ENTRY INSERT INTO t1 VALUES (1),(1); -sync_slave_with_master; -connection master; drop table t1; +sync_slave_with_master; # End of 4.1 tests diff --git a/mysql-test/include/maria_empty_logs.inc b/mysql-test/include/maria_empty_logs.inc index bbe6673f10d..cc93e214348 100644 --- a/mysql-test/include/maria_empty_logs.inc +++ b/mysql-test/include/maria_empty_logs.inc @@ -11,9 +11,10 @@ connection default; let $default_db=`select database()`; let $MYSQLD_DATADIR= `SELECT @@datadir`; -# it will used at end of test for wait_for_status_var.inc primitive -let $status_var= Threads_connected; -let $status_var_value= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1); + +#it will used at end of test for wait_for_status_var.inc primitive +#let $status_var= Threads_connected; +#let $status_var_value= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1); connection admin; -- echo * shut down mysqld, removed logs, restarted it @@ -77,12 +78,15 @@ append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; restart-maria_empty_logs.inc EOF +connection default; --source include/wait_until_connected_again.inc -connection default; # Make sure that all connections are restored ---source include/wait_for_status_var.inc +# This is disabled as 'Threads_connected' can't be trusted' +# (It may be affected by 'check_testcase()') +# --source include/wait_for_status_var.inc # Restore current database as the effect of "use" was lost after restart + --disable_query_log eval use $default_db; --enable_query_log diff --git a/mysql-test/suite/binlog/r/binlog_index.result b/mysql-test/suite/binlog/r/binlog_index.result index 52d698e9f96..01a41b55125 100644 --- a/mysql-test/suite/binlog/r/binlog_index.result +++ b/mysql-test/suite/binlog/r/binlog_index.result @@ -3,6 +3,7 @@ call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to process registered call mtr.add_suppression('MSYQL_BIN_LOG::open failed to sync the index file'); call mtr.add_suppression('Turning logging off for the whole duration of the MySQL server process.'); call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to clean registers before purging logs.'); +flush tables; flush logs; flush logs; flush logs; diff --git a/mysql-test/suite/binlog/t/binlog_index-master.opt b/mysql-test/suite/binlog/t/binlog_index-master.opt new file mode 100644 index 00000000000..26cd87ef8c3 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_index-master.opt @@ -0,0 +1 @@ +--skip-stack-trace --test-expect-abort --log-warnings=0 diff --git a/mysql-test/suite/binlog/t/binlog_index.test b/mysql-test/suite/binlog/t/binlog_index.test index 9d4a49602a6..94923275a5f 100644 --- a/mysql-test/suite/binlog/t/binlog_index.test +++ b/mysql-test/suite/binlog/t/binlog_index.test @@ -11,6 +11,8 @@ call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to process registered call mtr.add_suppression('MSYQL_BIN_LOG::open failed to sync the index file'); call mtr.add_suppression('Turning logging off for the whole duration of the MySQL server process.'); call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to clean registers before purging logs.'); +flush tables; + let $old=`select @@debug`; let $MYSQLD_DATADIR= `select @@datadir`; diff --git a/mysql-test/suite/pbxt/r/multi_statement.result b/mysql-test/suite/pbxt/r/multi_statement.result index 21a62e01bca..44877804727 100644 --- a/mysql-test/suite/pbxt/r/multi_statement.result +++ b/mysql-test/suite/pbxt/r/multi_statement.result @@ -47,5 +47,5 @@ i 3 show status like 'Slow_queries'|||| Variable_name Value -Slow_queries 0 +Slow_queries 3 drop table t1|||| diff --git a/mysql-test/suite/pbxt/t/multi_statement-master.opt b/mysql-test/suite/pbxt/t/multi_statement-master.opt new file mode 100644 index 00000000000..c735cf4c21b --- /dev/null +++ b/mysql-test/suite/pbxt/t/multi_statement-master.opt @@ -0,0 +1,3 @@ +--slow-query-log +--slow-query-log-file=slow.log +--log-queries-not-using-indexes diff --git a/sql/events.cc b/sql/events.cc index d167a3dd4e9..31eddada282 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -1263,8 +1263,9 @@ Events::load_events_from_db(THD *thd) } } } - sql_print_information("Event Scheduler: Loaded %d event%s", - count, (count == 1) ? "" : "s"); + if (global_system_variables.log_warnings) + sql_print_information("Event Scheduler: Loaded %d event%s", + count, (count == 1) ? "" : "s"); ret= FALSE; end: diff --git a/sql/handler.cc b/sql/handler.cc index 876512ed87f..b817673ed23 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -4298,6 +4298,8 @@ int handler::index_read_idx_map(uchar * buf, uint index, const uchar * key, enum ha_rkey_function find_flag) { int error, error1; + LINT_INIT(error1); + error= index_init(index, 0); if (!error) { diff --git a/sql/log.cc b/sql/log.cc index 6d0314b1d19..f52e68dd1b9 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1216,6 +1216,7 @@ void LOGGER::deactivate_log_handler(THD *thd, uint log_type) { my_bool *tmp_opt= 0; MYSQL_LOG *file_log; + LINT_INIT(file_log); switch (log_type) { case QUERY_LOG_SLOW: diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 6b5783b7e2e..55a889b55af 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1,4 +1,5 @@ /* Copyright (C) 2000-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc. + 2009-2010 Monty Program Ab This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -382,7 +383,7 @@ static bool volatile select_thread_in_use, signal_thread_in_use; static bool volatile ready_to_exit; static my_bool opt_debugging= 0, opt_external_locking= 0, opt_console= 0; static my_bool opt_short_log_format= 0; -static my_bool opt_ignore_wrong_options= 0; +static my_bool opt_ignore_wrong_options= 0, opt_expect_abort= 0; static uint kill_cached_threads, wake_thread; ulong thread_created; static ulong max_used_connections; @@ -2530,13 +2531,19 @@ extern "C" sig_handler handle_segfault(int sig) curr_time= my_time(0); localtime_r(&curr_time, &tm); - fprintf(stderr,"\ -%02d%02d%02d %2d:%02d:%02d - mysqld got " SIGNAL_FMT " ;\n\ + fprintf(stderr, "%02d%02d%02d %2d:%02d:%02d ", + tm.tm_year % 100, tm.tm_mon+1, tm.tm_mday, + tm.tm_hour, tm.tm_min, tm.tm_sec); + if (opt_expect_abort && sig == SIGABRT) + { + fprintf(stderr,"[Note] mysqld did an expected abort\n"); + goto end; + } + + fprintf(stderr,"[ERROR] mysqld got " SIGNAL_FMT " ;\n\ This could be because you hit a bug. It is also possible that this binary\n\ or one of the libraries it was linked against is corrupt, improperly built,\n\ or misconfigured. This error can also be caused by malfunctioning hardware.\n", - tm.tm_year % 100, tm.tm_mon+1, tm.tm_mday, - tm.tm_hour, tm.tm_min, tm.tm_sec, sig); fprintf(stderr, "\ We will try our best to scrape up some info that will hopefully help diagnose\n\ @@ -2655,6 +2662,7 @@ bugs.\n"); } #endif +end: #ifndef __WIN__ /* On Windows, do not terminate, but pass control to exception filter */ exit(1); @@ -5888,7 +5896,7 @@ enum options_mysqld OPT_MIN_EXAMINED_ROW_LIMIT, OPT_LOG_SLOW_SLAVE_STATEMENTS, OPT_DEBUG_CRC, OPT_DEBUG_ON, OPT_OLD_MODE, - OPT_TEST_IGNORE_WRONG_OPTIONS, + OPT_TEST_IGNORE_WRONG_OPTIONS, OPT_TEST_RESTART, #if defined(ENABLED_DEBUG_SYNC) OPT_DEBUG_SYNC_TIMEOUT, #endif /* defined(ENABLED_DEBUG_SYNC) */ @@ -6737,6 +6745,10 @@ log and this option does nothing anymore.", "Ignore wrong enums values in command line arguments. Useful only for test scripts", (uchar**) &opt_ignore_wrong_options, (uchar**) &opt_ignore_wrong_options, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"test-expect-abort", OPT_TEST_RESTART, + "Expect that server aborts with 'abort'; Don't write out server variables on 'abort'. Useful only for test scripts", + (uchar**) &opt_expect_abort, (uchar**) &opt_expect_abort, + 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"timed_mutexes", OPT_TIMED_MUTEXES, "Specify whether to time mutexes (only InnoDB mutexes are currently supported)", (uchar**) &timed_mutexes, (uchar**) &timed_mutexes, 0, GET_BOOL, NO_ARG, 0, diff --git a/sql/set_var.cc b/sql/set_var.cc index faea858c2b9..bf126fb09e4 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -2590,7 +2590,7 @@ static int sys_check_log_path(THD *thd, set_var *var) char path[FN_REFLEN], buff[FN_REFLEN]; MY_STAT f_stat; String str(buff, sizeof(buff), system_charset_info), *res; - const char *log_file_str; + const char *log_file_str= 0; size_t path_length; if (!(res= var->value->val_str(&str))) @@ -2640,7 +2640,7 @@ static int sys_check_log_path(THD *thd, set_var *var) err: my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), var->var->name, - res ? log_file_str : "NULL"); + log_file_str ? log_file_str : "NULL"); return 1; } @@ -2649,7 +2649,7 @@ bool update_sys_var_str_path(THD *thd, sys_var_str *var_str, set_var *var, const char *log_ext, bool log_state, uint log_type) { - MYSQL_QUERY_LOG *file_log; + MYSQL_QUERY_LOG *file_log= 0; char buff[FN_REFLEN]; char *res= 0, *old_value=(char *)(var ? var->value->str_value.ptr() : 0); bool result= 0; diff --git a/sql/slave.cc b/sql/slave.cc index 3a62785886d..3639330c8e7 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -2255,6 +2255,7 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli) if (slave_trans_retries) { int temp_err; + LINT_INIT(temp_err); if (exec_res && (temp_err= has_temporary_error(thd))) { const char *errmsg; diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index b33d3c0b3ff..4ead793737b 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -1701,9 +1701,10 @@ bool mysql_install_plugin(THD *thd, const LEX_STRING *name, const LEX_STRING *dl if (tmp->state == PLUGIN_IS_DISABLED) { - push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_CANT_INITIALIZE_UDF, ER(ER_CANT_INITIALIZE_UDF), - name->str, "Plugin is disabled"); + if (global_system_variables.log_warnings) + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_CANT_INITIALIZE_UDF, ER(ER_CANT_INITIALIZE_UDF), + name->str, "Plugin is disabled"); } else { diff --git a/storage/xtradb/include/ut0lst.h b/storage/xtradb/include/ut0lst.h index fa7a186dfb1..7b15c052978 100644 --- a/storage/xtradb/include/ut0lst.h +++ b/storage/xtradb/include/ut0lst.h @@ -158,7 +158,7 @@ Inserts a NODE2 after NODE1 in a list. /** Invalidate the pointers in a list node. @param NAME list name @param N pointer to the node that was removed */ -# define UT_LIST_REMOVE_CLEAR(NAME, N) {} while (0) +# define UT_LIST_REMOVE_CLEAR(NAME, N) do {} while (0) #endif /*******************************************************************//** diff --git a/support-files/compiler_warnings.supp b/support-files/compiler_warnings.supp index 0195ed071db..bd77e3b4a08 100644 --- a/support-files/compiler_warnings.supp +++ b/support-files/compiler_warnings.supp @@ -40,6 +40,7 @@ sync/sync0sync\.c: unused parameter sync/sync0sync\.c: unused variable ut/ut0ut\.c: ignoring return value of srv/srv0srv\.c: value computed is not used +buf/buf0buf\.c: warning: .*block_mutex.* might be used uninitialized # # bdb is not critical to keep up to date From b34262264ab916fd8f261333b6caae6a4e3d17be Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Wed, 7 Apr 2010 18:26:30 +0300 Subject: [PATCH 2/3] Fixed suppression of compiler/test warnings Fixed some timing issues in test suite mysql-test/mysql-test-run.pl: Added suppression of errors that comes when master is killed before slave has connect (like with rpl_udf.test) mysql-test/suite/funcs_1/datadict/processlist_priv.inc: Wait for check thread to end mysql-test/suite/pbxt/t/status.test: Added longer sleep to avoid timing issue support-files/compiler_warnings.supp: Fixed wrong suppression --- mysql-test/mysql-test-run.pl | 3 ++ .../funcs_1/datadict/processlist_priv.inc | 42 ++++++++++++++----- mysql-test/suite/pbxt/t/status.test | 2 +- support-files/compiler_warnings.supp | 2 +- 4 files changed, 36 insertions(+), 13 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index a06b29815a0..dc9fb4ef8ca 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -4015,7 +4015,10 @@ sub extract_warning_lines ($) { qr/Slave I\/O: Get master COLLATION_SERVER failed with error:.*/, qr/Slave I\/O: Get master TIME_ZONE failed with error:.*/, qr/Slave I\/O: error reconnecting to master '.*' - retry-time: [1-3] retries/, + qr/Slave I\/0: Master command COM_BINLOG_DUMP failed/, qr/Error reading packet/, + qr/Lost connection to MySQL server at 'reading initial communication packet'/, + qr/Failed on request_dump/, qr/Slave: Can't drop database.* database doesn't exist/, qr/Slave: Operation DROP USER failed for 'create_rout_db'/, qr|Checking table: '\./mtr/test_suppressions'|, diff --git a/mysql-test/suite/funcs_1/datadict/processlist_priv.inc b/mysql-test/suite/funcs_1/datadict/processlist_priv.inc index 9bd8eaedd14..1fffdf014e6 100644 --- a/mysql-test/suite/funcs_1/datadict/processlist_priv.inc +++ b/mysql-test/suite/funcs_1/datadict/processlist_priv.inc @@ -89,18 +89,38 @@ USE information_schema; --echo 1 Prepare test. --echo connection default (user=root) --echo #################################################################################### -if (`SELECT COUNT(*) <> 1 FROM processlist`) + +# Check that we have only one connection around. +# If there is more, it may be the check() connection that has not yet ended, +# so we wait for it for up to 10 seconds. + +let $counter=100; +while ($counter) { - --echo This test expects one connection to the server. - --echo Expectation: USER HOST DB COMMAND STATE INFO - --echo Expectation: root localhost information_schema Query executing SELECT USER,HOST,DB,COMMAND,STATE,INFO FROM processlist ORDER BY ID - --echo But we found in the moment: - SELECT USER,HOST,DB,COMMAND,STATE,INFO FROM processlist ORDER BY ID; - --echo Maybe - --echo - the base configuration (no of parallel auxiliary sessions) of the server has changed - --echo - a parallel test intended for another server accidently connected to our current one - --echo We cannot proceed in this situation. Abort - exit; + dec $counter; + let $res= `SELECT COUNT(*) <> 1 FROM processlist`; + if (!$res) + { + # Success; Abort while loop + let $counter=0; + } + if ($res) + { + --sleep 0.1 + if (!$counter) + { + --echo This test expects one connection to the server. + --echo Expectation: USER HOST DB COMMAND STATE INFO + --echo Expectation: root localhost information_schema Query executing SELECT USER,HOST,DB,COMMAND,STATE,INFO FROM processlist ORDER BY ID + --echo But we found in the moment: + SELECT USER,HOST,DB,COMMAND,STATE,INFO FROM processlist ORDER BY ID; + --echo Maybe + --echo - the base configuration (no of parallel auxiliary sessions) of the server has changed + --echo - a parallel test intended for another server accidently connected to our current one + --echo We cannot proceed in this situation. Abort + exit; + } + } } --echo #################################################################################### diff --git a/mysql-test/suite/pbxt/t/status.test b/mysql-test/suite/pbxt/t/status.test index 8a3d43ea475..4ecb6acfd6f 100644 --- a/mysql-test/suite/pbxt/t/status.test +++ b/mysql-test/suite/pbxt/t/status.test @@ -30,7 +30,7 @@ connection con1; --send update t1 set n = 3; connection con2; -sleep 0.5; +sleep 5; unlock tables; connection con1; reap; diff --git a/support-files/compiler_warnings.supp b/support-files/compiler_warnings.supp index bd77e3b4a08..36442cb2e36 100644 --- a/support-files/compiler_warnings.supp +++ b/support-files/compiler_warnings.supp @@ -40,7 +40,7 @@ sync/sync0sync\.c: unused parameter sync/sync0sync\.c: unused variable ut/ut0ut\.c: ignoring return value of srv/srv0srv\.c: value computed is not used -buf/buf0buf\.c: warning: .*block_mutex.* might be used uninitialized +buf/buf0buf\.c: .*block_mutex.* might be used uninitialized # # bdb is not critical to keep up to date From 04ff96f7891cf4a714a3f60a4ec15b5ead7a3f31 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Thu, 8 Apr 2010 12:47:31 +0300 Subject: [PATCH 3/3] Fixed syntax error and some timeing issues in test suite mysql-test/r/func_time.result: Updated result mysql-test/t/func_time.test: sysdate() could be same even with one sleep(1) in between. storage/maria/ma_loghandler.c: Fixed syntax error --- mysql-test/r/func_time.result | 2 +- mysql-test/t/func_time.test | 2 +- storage/maria/ma_loghandler.c | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 2ac549a5abd..22c8a6e4b6f 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1120,7 +1120,7 @@ drop function t_slow_sysdate; drop table t1; SET GLOBAL log_bin_trust_function_creators = 0; create table t1 (a datetime, i int, b datetime); -insert into t1 select sysdate(), sleep(1), sysdate() from dual; +insert into t1 select sysdate(), sleep(2), sysdate() from dual; select a != b from t1; a != b 1 diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index b9da946a55f..2f9a48ffd6a 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -650,7 +650,7 @@ drop table t1; SET GLOBAL log_bin_trust_function_creators = 0; create table t1 (a datetime, i int, b datetime); -insert into t1 select sysdate(), sleep(1), sysdate() from dual; +insert into t1 select sysdate(), sleep(2), sysdate() from dual; select a != b from t1; drop table t1; diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index 5e316e2d776..8ffaf22d1b0 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -1211,9 +1211,10 @@ static my_bool translog_set_lsn_for_files(uint32 from_file, uint32 to_file, for (file= from_file; file <= to_file; file++) { LOGHANDLER_FILE_INFO info; + File fd; LINT_INIT(info.max_lsn); - File fd= open_logfile_by_number_no_cache(file); + fd= open_logfile_by_number_no_cache(file); if ((fd < 0) || ((translog_read_file_header(&info, fd) || (cmp_translog_addr(lsn, info.max_lsn) > 0 &&