From 663fee9c052bf061191a68dff7d77a1362ca2e21 Mon Sep 17 00:00:00 2001 From: "evgen@moonbone.local" <> Date: Fri, 21 Apr 2006 01:52:59 +0400 Subject: [PATCH 1/9] Fixed bug#18739: non-standard HAVING extension was allowed in strict ANSI sql mode. The SQL standard doesn't allow to use in HAVING clause fields that are not present in GROUP BY clause and not under any aggregate function in the HAVING clause. However, mysql allows using such fields. This extension assume that the non-grouping fields will have the same group-wise values. Otherwise, the result will be unpredictable. This extension allowed in strict MODE_ONLY_FULL_GROUP_BY sql mode results in misunderstanding of HAVING capabilities. The new error message ER_NON_GROUPING_FIELD_USED message is added. It says "non-grouping field '%-.64s' is used in %-.64s clause". This message is supposed to be used for reporting errors when some field is not found in the GROUP BY clause but have to be present there. Use cases for this message are this bug and when a field is present in a SELECT item list not under any aggregate function and there is GROUP BY clause present which doesn't mention that field. It renders the ER_WRONG_FIELD_WITH_GROUP error message obsolete as being more descriptive. The resolve_ref_in_select_and_group() function now reports the ER_NON_GROUPING_FIELD_FOUND error if the strict mode is set and the field for HAVING clause is found in the SELECT item list only. --- mysql-test/r/having.result | 13 +++++++++++++ mysql-test/t/having.test | 13 +++++++++++++ sql/item.cc | 18 ++++++++++++++++-- sql/share/errmsg.txt | 2 ++ sql/sql_select.cc | 4 ++++ 5 files changed, 48 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result index fe918e4c3ff..a37f260ff31 100644 --- a/mysql-test/r/having.result +++ b/mysql-test/r/having.result @@ -392,3 +392,16 @@ HAVING HU.PROJ.CITY = HU.STAFF.CITY); EMPNUM GRADE*1000 E3 13000 DROP SCHEMA HU; +USE test; +create table t1(f1 int); +select f1 from t1 having max(f1)=f1; +f1 +select f1 from t1 group by f1 having max(f1)=f1; +f1 +set session sql_mode='ONLY_FULL_GROUP_BY'; +select f1 from t1 having max(f1)=f1; +ERROR 42000: non-grouping field 'f1' is used in HAVING clause +select f1 from t1 group by f1 having max(f1)=f1; +f1 +set session sql_mode=''; +drop table t1; diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test index 9b21e544657..779b694987b 100644 --- a/mysql-test/t/having.test +++ b/mysql-test/t/having.test @@ -393,3 +393,16 @@ SELECT EMPNUM, GRADE*1000 HAVING HU.PROJ.CITY = HU.STAFF.CITY); DROP SCHEMA HU; +USE test; +# +# Bug#18739: non-standard HAVING extension was allowed in strict ANSI sql mode. +# +create table t1(f1 int); +select f1 from t1 having max(f1)=f1; +select f1 from t1 group by f1 having max(f1)=f1; +set session sql_mode='ONLY_FULL_GROUP_BY'; +--error 1461 +select f1 from t1 having max(f1)=f1; +select f1 from t1 group by f1 having max(f1)=f1; +set session sql_mode=''; +drop table t1; diff --git a/sql/item.cc b/sql/item.cc index e3da950ceef..9498bf3fcd8 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -3153,7 +3153,8 @@ static Item** find_field_in_group_list(Item *find_item, ORDER *group_list) both clauses contain different fields with the same names, a warning is issued that name of 'ref' is ambiguous. We extend ANSI SQL in that when no GROUP BY column is found, then a HAVING name is resolved as a possibly - derived SELECT column. + derived SELECT column. This extension is allowed only if the + MODE_ONLY_FULL_GROUP_BY sql mode isn't enabled. NOTES The resolution procedure is: @@ -3163,7 +3164,9 @@ static Item** find_field_in_group_list(Item *find_item, ORDER *group_list) in the GROUP BY clause of Q. - If found different columns with the same name in GROUP BY and SELECT - issue a warning and return the GROUP BY column, - - otherwise return the found SELECT column. + - otherwise + - if the MODE_ONLY_FULL_GROUP_BY mode is enabled return error + - else return the found SELECT column. RETURN @@ -3208,6 +3211,17 @@ resolve_ref_in_select_and_group(THD *thd, Item_ident *ref, SELECT_LEX *select) } } + if (thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY && + select_ref != not_found_item && !group_by_ref) + { + /* + Report the error if fields was found only in the SELECT item list and + the strict mode is enabled. + */ + my_error(ER_NON_GROUPING_FIELD_USED, MYF(0), + ref->name, "HAVING"); + return NULL; + } if (select_ref != not_found_item || group_by_ref) { if (select_ref != not_found_item && !ambiguous_fields) diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 37487c245a9..e0adb3fc408 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -5611,3 +5611,5 @@ ER_TABLE_NEEDS_UPGRADE eng "Table upgrade required. Please do \"REPAIR TABLE `%-.32s`\" to fix it!" ER_SP_NO_AGGREGATE 42000 eng "AGGREGATE is not supported for stored functions" +ER_NON_GROUPING_FIELD_USED 42000 + eng "non-grouping field '%-.64s' is used in %-.64s clause" diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 0211539e784..8daed345433 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -12613,6 +12613,10 @@ setup_group(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables, if (item->type() != Item::SUM_FUNC_ITEM && !item->marker && !item->const_item()) { + /* + TODO: change ER_WRONG_FIELD_WITH_GROUP to more detailed + ER_NON_GROUPING_FIELD_USED + */ my_error(ER_WRONG_FIELD_WITH_GROUP, MYF(0), item->full_name()); return 1; } From 57980ef4d52a9495d18be80fb8716e8ecb80f522 Mon Sep 17 00:00:00 2001 From: "jimw@mysql.com" <> Date: Thu, 20 Apr 2006 19:17:14 -0700 Subject: [PATCH 2/9] Bug #18617: mysql-test-run.pl, partially wrong handling of option "start-dirty" This was a case of too much code. The --start-dirty option should act just like --start-and-exit, except it skips the database initialization step. Now it does, which means it picks up the options from the specified test case. --- mysql-test/mysql-test-run.pl | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index a045441e046..f37fb5b721a 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -407,22 +407,7 @@ sub main () { } } - if ( $opt_start_dirty ) - { - if ( ndbcluster_start($opt_with_ndbcluster) ) - { - mtr_error("Can't start ndbcluster"); - } - if ( mysqld_start('master',0,[],[],$using_ndbcluster_master) ) - { - mtr_report("Servers started, exiting"); - } - else - { - mtr_error("Can't start the mysqld server"); - } - } - elsif ( $opt_bench ) + if ( $opt_bench ) { run_benchmarks(shift); # Shift what? Extra arguments?! } @@ -2027,10 +2012,11 @@ sub run_testcase ($) { } # ---------------------------------------------------------------------- - # If --start-and-exit given, stop here to let user manually run tests + # If --start-and-exit or --start-dirty given, stop here to let user manually + # run tests # ---------------------------------------------------------------------- - if ( $opt_start_and_exit ) + if ( $opt_start_and_exit or $opt_start_dirty ) { mtr_report("\nServers started, exiting"); exit(0); @@ -3409,11 +3395,12 @@ Misc options comment=STR Write STR to the output script-debug Debug this script itself timer Show test case execution time - start-and-exit Only initiate and start the "mysqld" servers, use the startup - settings for the specified test case if any - start-dirty Only start the "mysqld" servers without initiation - fast Don't try to cleanup from earlier runs - reorder Reorder tests to get less server restarts + start-and-exit Only initialize and start the servers, using the + startup settings for the specified test case (if any) + start-dirty Only start the servers (without initialization) for + the specified test case (if any) + fast Don't try to clean up from earlier runs + reorder Reorder tests to get fewer server restarts help Get this help text unified-diff | udiff When presenting differences, use unified diff From 4d392fb9f4a2cb50fb72393cb0f1512d515f05f5 Mon Sep 17 00:00:00 2001 From: "jimw@mysql.com" <> Date: Thu, 20 Apr 2006 20:41:12 -0700 Subject: [PATCH 3/9] Bug #16195: SHOW VARIABLES doesn't report correctly sql_warnings and sql_notes values SQL_WARNINGS and SQL_NOTES were being displayed with SHOW_BOOL, but they are system variables that need SHOW_SYS to be used. --- mysql-test/r/variables.result | 15 +++++++++++++++ mysql-test/t/variables.test | 13 ++++++++++++- sql/set_var.cc | 4 ++-- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index 1d1c76ab3fe..b6ff60ebb34 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -584,3 +584,18 @@ set @@global.character_set_filesystem=default; select @@global.character_set_filesystem; @@global.character_set_filesystem binary +set @@sql_notes = 0, @@sql_warnings = 0; +show variables like 'sql_notes'; +Variable_name Value +sql_notes OFF +show variables like 'sql_warnings'; +Variable_name Value +sql_warnings OFF +set @@sql_notes = 1, @@sql_warnings = 1; +show variables like 'sql_notes'; +Variable_name Value +sql_notes ON +show variables like 'sql_warnings'; +Variable_name Value +sql_warnings ON +End of 5.0 tests diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 8d8dc7896df..79f4675d013 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -472,4 +472,15 @@ select @@character_set_filesystem; set @@global.character_set_filesystem=default; select @@global.character_set_filesystem; -# End of 5.0 tests +# +# Bug #16195: SHOW VARIABLES doesn't report correctly sql_warnings and +# sql_notes values +# +set @@sql_notes = 0, @@sql_warnings = 0; +show variables like 'sql_notes'; +show variables like 'sql_warnings'; +set @@sql_notes = 1, @@sql_warnings = 1; +show variables like 'sql_notes'; +show variables like 'sql_warnings'; + +--echo End of 5.0 tests diff --git a/sql/set_var.cc b/sql/set_var.cc index a0b60251354..1f46865b260 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -989,8 +989,8 @@ struct show_var_st init_vars[]= { #endif {sys_sort_buffer.name, (char*) &sys_sort_buffer, SHOW_SYS}, {sys_sql_mode.name, (char*) &sys_sql_mode, SHOW_SYS}, - {"sql_notes", (char*) &sys_sql_notes, SHOW_BOOL}, - {"sql_warnings", (char*) &sys_sql_warnings, SHOW_BOOL}, + {"sql_notes", (char*) &sys_sql_notes, SHOW_SYS}, + {"sql_warnings", (char*) &sys_sql_warnings, SHOW_SYS}, {sys_storage_engine.name, (char*) &sys_storage_engine, SHOW_SYS}, {sys_sync_frm.name, (char*) &sys_sync_frm, SHOW_SYS}, #ifdef HAVE_TZNAME From ec00b92f48b9ed02731ad37f51477d6c8cb1f277 Mon Sep 17 00:00:00 2001 From: "jimw@mysql.com" <> Date: Thu, 20 Apr 2006 21:56:53 -0700 Subject: [PATCH 4/9] Bug #12792: @@system_time_zone is not SELECTable Bug #15684: @@version_* are not all SELECTable Added the appropriate information as read-only system variables, and also removed some special-case handling of @@version along the way. @@version_bdb was added, but isn't included in the test because it depends on the presence of BDB. --- mysql-test/r/variables.result | 11 ++++++++++- mysql-test/t/variables.test | 21 +++++++++++++++++++-- sql/item_func.cc | 6 ------ sql/set_var.cc | 33 ++++++++++++++++++++++++++------- 4 files changed, 55 insertions(+), 16 deletions(-) diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index 1d1c76ab3fe..77b3b54c861 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -275,7 +275,7 @@ ERROR HY000: Variable 'autocommit' is a SESSION variable and can't be used with select @@global.timestamp; ERROR HY000: Variable 'timestamp' is a SESSION variable set @@version=''; -ERROR HY000: Unknown system variable 'version' +ERROR HY000: Variable 'version' is a read only variable set @@concurrent_insert=1; ERROR HY000: Variable 'concurrent_insert' is a GLOBAL variable and should be set with SET GLOBAL set @@global.sql_auto_is_null=1; @@ -384,6 +384,7 @@ select @@sql_max_join_size,@@max_join_size; set sql_quote_show_create=1; set sql_safe_updates=1; set sql_select_limit=1; +set sql_select_limit=default; set sql_warnings=1; set global table_cache=100; set storage_engine=myisam; @@ -584,3 +585,11 @@ set @@global.character_set_filesystem=default; select @@global.character_set_filesystem; @@global.character_set_filesystem binary +select @@system_time_zone; +@@system_time_zone +# +select @@version, @@version_comment, @@version_compile_machine, +@@version_compile_os; +@@version @@version_comment @@version_compile_machine @@version_compile_os +# # # # +End of 5.0 tests diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 8d8dc7896df..fde352efa7b 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -169,7 +169,7 @@ set collation_connection=NULL; set global autocommit=1; --error 1238 select @@global.timestamp; ---error 1193 +--error 1238 set @@version=''; --error 1229 set @@concurrent_insert=1; @@ -258,6 +258,8 @@ select @@sql_max_join_size,@@max_join_size; set sql_quote_show_create=1; set sql_safe_updates=1; set sql_select_limit=1; +# reset it, so later tests don't get confused +set sql_select_limit=default; set sql_warnings=1; set global table_cache=100; set storage_engine=myisam; @@ -472,4 +474,19 @@ select @@character_set_filesystem; set @@global.character_set_filesystem=default; select @@global.character_set_filesystem; -# End of 5.0 tests +# +# Bug #12792: @@system_time_zone is not SELECTable. +# +# Don't actually output, since it depends on the system +--replace_column 1 # +select @@system_time_zone; + +# +# Bug #15684: system variables cannot be SELECTed (e.g. @@version_comment) +# +# Don't actually output, since it depends on the system +--replace_column 1 # 2 # 3 # 4 # +select @@version, @@version_comment, @@version_compile_machine, + @@version_compile_os; + +--echo End of 5.0 tests diff --git a/sql/item_func.cc b/sql/item_func.cc index 4bdb62c6e7a..1eda622ab0d 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -4558,12 +4558,6 @@ Item *get_system_var(THD *thd, enum_var_type var_type, LEX_STRING name, sys_var *var; LEX_STRING *base_name, *component_name; - if (component.str == 0 && - !my_strcasecmp(system_charset_info, name.str, "VERSION")) - return new Item_string(NULL, server_version, - (uint) strlen(server_version), - system_charset_info, DERIVATION_SYSCONST); - if (component.str) { base_name= &component; diff --git a/sql/set_var.cc b/sql/set_var.cc index a0b60251354..907f14c0c20 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -377,6 +377,8 @@ sys_var_thd_table_type sys_table_type("table_type", sys_var_thd_storage_engine sys_storage_engine("storage_engine", &SV::table_type); sys_var_bool_ptr sys_sync_frm("sync_frm", &opt_sync_frm); +sys_var_const_str sys_system_time_zone("system_time_zone", + system_time_zone); sys_var_long_ptr sys_table_cache_size("table_cache", &table_cache_size); sys_var_long_ptr sys_table_lock_wait_timeout("table_lock_wait_timeout", @@ -391,6 +393,16 @@ sys_var_thd_ulong sys_tmp_table_size("tmp_table_size", &SV::tmp_table_size); sys_var_bool_ptr sys_timed_mutexes("timed_mutexes", &timed_mutexes); +sys_var_const_str sys_version("version", server_version); +#ifdef HAVE_BERKELEY_DB +sys_var_const_str sys_version_bdb("version_bdb", DB_VERSION_STRING); +#endif +sys_var_const_str sys_version_comment("version_comment", + MYSQL_COMPILATION_COMMENT); +sys_var_const_str sys_version_compile_machine("version_compile_machine", + MACHINE_TYPE); +sys_var_const_str sys_version_compile_os("version_compile_os", + SYSTEM_TYPE); sys_var_thd_ulong sys_net_wait_timeout("wait_timeout", &SV::net_wait_timeout); @@ -546,7 +558,6 @@ sys_var_thd_time_zone sys_time_zone("time_zone"); /* Read only variables */ -sys_var_const_str sys_os("version_compile_os", SYSTEM_TYPE); sys_var_readonly sys_have_innodb("have_innodb", OPT_GLOBAL, SHOW_CHAR, get_have_innodb); /* Global read-only variable describing server license */ @@ -698,6 +709,7 @@ sys_var *sys_variables[]= &sys_sql_notes, &sys_storage_engine, &sys_sync_frm, + &sys_system_time_zone, &sys_table_cache_size, &sys_table_lock_wait_timeout, &sys_table_type, @@ -710,7 +722,13 @@ sys_var *sys_variables[]= &sys_trans_alloc_block_size, &sys_trans_prealloc_size, &sys_tx_isolation, - &sys_os, + &sys_version, +#ifdef HAVE_BERKELEY_DB + &sys_version_bdb, +#endif + &sys_version_comment, + &sys_version_compile_machine, + &sys_version_compile_os, #ifdef HAVE_INNOBASE_DB &sys_innodb_fast_shutdown, &sys_innodb_max_dirty_pages_pct, @@ -1015,13 +1033,14 @@ struct show_var_st init_vars[]= { {sys_tx_isolation.name, (char*) &sys_tx_isolation, SHOW_SYS}, {sys_updatable_views_with_limit.name, (char*) &sys_updatable_views_with_limit,SHOW_SYS}, - {"version", server_version, SHOW_CHAR}, + {sys_version.name, (char*) &sys_version, SHOW_SYS}, #ifdef HAVE_BERKELEY_DB - {"version_bdb", (char*) DB_VERSION_STRING, SHOW_CHAR}, + {sys_version_bdb.name, (char*) &sys_version_bdb, SHOW_SYS}, #endif - {"version_comment", (char*) MYSQL_COMPILATION_COMMENT, SHOW_CHAR}, - {"version_compile_machine", (char*) MACHINE_TYPE, SHOW_CHAR}, - {sys_os.name, (char*) &sys_os, SHOW_SYS}, + {sys_version_comment.name, (char*) &sys_version_comment, SHOW_SYS}, + {sys_version_compile_machine.name, (char*) &sys_version_compile_machine, + SHOW_SYS}, + {sys_version_compile_os.name, (char*) &sys_version_compile_os, SHOW_SYS}, {sys_net_wait_timeout.name, (char*) &sys_net_wait_timeout, SHOW_SYS}, {NullS, NullS, SHOW_LONG} }; From 559995f160ef36a7e5a3b9afdd2aa6b31521efb7 Mon Sep 17 00:00:00 2001 From: "jimw@mysql.com" <> Date: Fri, 21 Apr 2006 09:48:49 -0700 Subject: [PATCH 5/9] Bug #19083 ./mysql-test-run.pl starts NDB when it is not needed Now NDB is only initialized and started when the tests that are being run will make use of it. The same thing is also done for the slave databases and the instance manager. After review from Magnus: Only take a snapshot of the data directories that are in use. --- mysql-test/mysql-test-run.pl | 107 ++++++++++++++++++++++------------- mysql-test/ndb/ndbcluster.sh | 4 +- 2 files changed, 71 insertions(+), 40 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index a045441e046..63bc9115891 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -333,6 +333,7 @@ our @data_dir_lst; sub main (); sub initial_setup (); sub command_line_setup (); +sub snapshot_setup (); sub executable_setup (); sub environment_setup (); sub kill_running_server (); @@ -343,7 +344,7 @@ sub ndbcluster_install (); sub ndbcluster_start ($); sub ndbcluster_stop (); sub run_benchmarks ($); -sub run_tests (); +sub initialize_servers (); sub mysql_install_db (); sub install_db ($$); sub run_testcase ($); @@ -374,7 +375,7 @@ sub main () { command_line_setup(); executable_setup(); - check_ndbcluster_support(); + check_ndbcluster_support(); # We check whether to actually use it later check_ssl_support(); environment_setup(); @@ -389,24 +390,7 @@ sub main () { { gprof_prepare(); } - - if ( ! $glob_use_running_server ) - { - if ( $opt_start_dirty ) - { - kill_running_server(); - } - else - { - kill_and_cleanup(); - mysql_install_db(); - if ( $opt_force ) - { - save_installed_db(); - } - } - } - + if ( $opt_start_dirty ) { if ( ndbcluster_start($opt_with_ndbcluster) ) @@ -424,15 +408,35 @@ sub main () { } elsif ( $opt_bench ) { + initialize_servers(); run_benchmarks(shift); # Shift what? Extra arguments?! } elsif ( $opt_stress ) { + initialize_servers(); run_stress_test() } else { - run_tests(); + # Figure out which tests we are going to run + my $tests= collect_test_cases($opt_suite); + + # Turn off NDB and other similar options if no tests use it + my ($need_ndbcluster,$need_im,$need_slave); + foreach my $test (@$tests) + { + $need_ndbcluster||= $test->{ndb_test}; + $need_im||= $test->{component_id} eq 'im'; + $need_slave||= $test->{slave_num}; + } + $opt_with_ndbcluster= 0 unless $need_ndbcluster; + $opt_skip_im= 1 unless $need_im; + $opt_skip_rpl= 1 unless $need_slave; + + snapshot_setup(); + initialize_servers(); + + run_suite($opt_suite, $tests); } mtr_exit(0); @@ -983,20 +987,29 @@ sub command_line_setup () { $path_mysqltest_log= "$opt_vardir/log/mysqltest.log"; $path_snapshot= "$opt_tmpdir/snapshot_$opt_master_myport/"; +} + +sub snapshot_setup () { # Make a list of all data_dirs @data_dir_lst = ( $master->[0]->{'path_myddir'}, - $master->[1]->{'path_myddir'}, - $slave->[0]->{'path_myddir'}, - $slave->[1]->{'path_myddir'}, - $slave->[2]->{'path_myddir'}); + $master->[1]->{'path_myddir'}); - foreach my $instance (@{$instance_manager->{'instances'}}) + unless ($opt_skip_rpl) { - push(@data_dir_lst, $instance->{'path_datadir'}); + push @data_dir_lst, ($slave->[0]->{'path_myddir'}, + $slave->[1]->{'path_myddir'}, + $slave->[2]->{'path_myddir'}); } + unless ($opt_skip_im) + { + foreach my $instance (@{$instance_manager->{'instances'}}) + { + push(@data_dir_lst, $instance->{'path_datadir'}); + } + } } @@ -1388,7 +1401,7 @@ sub check_ndbcluster_support () { if ($opt_with_ndbcluster) { - mtr_report("Using ndbcluster"); + mtr_report("Using ndbcluster if necessary"); return; } @@ -1404,7 +1417,7 @@ sub check_ndbcluster_support () { $opt_with_ndbcluster= 0; return; } - mtr_report("Using ndbcluster, mysqld supports it"); + mtr_report("Using ndbcluster if necessary, mysqld supports it"); $opt_with_ndbcluster= 1; return; } @@ -1561,12 +1574,9 @@ sub run_benchmarks ($) { # FIXME how to specify several suites to run? Comma separated list? -sub run_tests () { - run_suite($opt_suite); -} sub run_suite () { - my $suite= shift; + my ($suite, $tests)= @_; mtr_print_thick_line(); @@ -1574,8 +1584,6 @@ sub run_suite () { mtr_timer_start($glob_timers,"suite", 60 * $opt_suite_timeout); - my $tests= collect_test_cases($suite); - mtr_report("Starting Tests in the '$suite' suite"); mtr_print_header(); @@ -1617,14 +1625,37 @@ sub run_suite () { # ############################################################################## +sub initialize_servers () { + if ( ! $glob_use_running_server ) + { + if ( $opt_start_dirty ) + { + kill_running_server(); + } + else + { + kill_and_cleanup(); + mysql_install_db(); + if ( $opt_force ) + { + save_installed_db(); + } + } + } +} + sub mysql_install_db () { # FIXME not exactly true I think, needs improvements install_db('master', $master->[0]->{'path_myddir'}); install_db('master', $master->[1]->{'path_myddir'}); - install_db('slave', $slave->[0]->{'path_myddir'}); - install_db('slave', $slave->[1]->{'path_myddir'}); - install_db('slave', $slave->[2]->{'path_myddir'}); + + if ( ! $opt_skip_rpl ) + { + install_db('slave', $slave->[0]->{'path_myddir'}); + install_db('slave', $slave->[1]->{'path_myddir'}); + install_db('slave', $slave->[2]->{'path_myddir'}); + } if ( ! $opt_skip_im ) { diff --git a/mysql-test/ndb/ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh index c09c013552e..c17b3d316f4 100644 --- a/mysql-test/ndb/ndbcluster.sh +++ b/mysql-test/ndb/ndbcluster.sh @@ -232,8 +232,8 @@ cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile" # test if Ndb Cluster starts properly -echo "Waiting for started..." -if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK"; then :; else +echo "Waiting for NDB data nodes to start..." +if ( $exec_waiter ) | grep -q "NDBT_ProgramExit: 0 - OK"; then :; else echo "Ndbcluster startup failed" stop_default_ndbcluster exit 1 From 3c06a20bfe35bf8f2fed55c4159251a598f760a3 Mon Sep 17 00:00:00 2001 From: "evgen@moonbone.local" <> Date: Mon, 24 Apr 2006 20:59:23 +0400 Subject: [PATCH 6/9] having.test: After merge fix for bug#18739 --- mysql-test/t/having.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test index 779b694987b..9bea78a7bca 100644 --- a/mysql-test/t/having.test +++ b/mysql-test/t/having.test @@ -401,7 +401,7 @@ create table t1(f1 int); select f1 from t1 having max(f1)=f1; select f1 from t1 group by f1 having max(f1)=f1; set session sql_mode='ONLY_FULL_GROUP_BY'; ---error 1461 +--error 1463 select f1 from t1 having max(f1)=f1; select f1 from t1 group by f1 having max(f1)=f1; set session sql_mode=''; From 960c5621ebe7bd581a959146e1580158c816309f Mon Sep 17 00:00:00 2001 From: "jimw@mysql.com" <> Date: Wed, 26 Apr 2006 09:21:53 -0700 Subject: [PATCH 7/9] Bug #17849: sql_big_selects not shown in SHOW VARIABLES output This patch simply adds sql_big_selects to the list of variables output by SHOW VARIABLES. --- mysql-test/r/variables.result | 7 +++++++ mysql-test/t/variables.test | 10 +++++++++- sql/set_var.cc | 3 ++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index 1d1c76ab3fe..269a9bfdbd9 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -584,3 +584,10 @@ set @@global.character_set_filesystem=default; select @@global.character_set_filesystem; @@global.character_set_filesystem binary +set @old_sql_big_selects = @@sql_big_selects; +set @@sql_big_selects = 1; +show variables like 'sql_big_selects'; +Variable_name Value +sql_big_selects ON +set @@sql_big_selects = @old_sql_big_selects; +End of 5.0 tests diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 8d8dc7896df..5b8db2f8786 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -472,4 +472,12 @@ select @@character_set_filesystem; set @@global.character_set_filesystem=default; select @@global.character_set_filesystem; -# End of 5.0 tests +# +# Bug #17849: Show sql_big_selects in SHOW VARIABLES +# +set @old_sql_big_selects = @@sql_big_selects; +set @@sql_big_selects = 1; +show variables like 'sql_big_selects'; +set @@sql_big_selects = @old_sql_big_selects; + +--echo End of 5.0 tests diff --git a/sql/set_var.cc b/sql/set_var.cc index 71ecf97a6fa..4e8575f3df2 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -993,7 +993,8 @@ struct show_var_st init_vars[]= { #ifdef HAVE_SYS_UN_H {"socket", (char*) &mysqld_unix_port, SHOW_CHAR_PTR}, #endif - {sys_sort_buffer.name, (char*) &sys_sort_buffer, SHOW_SYS}, + {sys_sort_buffer.name, (char*) &sys_sort_buffer, SHOW_SYS}, + {sys_big_selects.name, (char*) &sys_big_selects, SHOW_SYS}, {sys_sql_mode.name, (char*) &sys_sql_mode, SHOW_SYS}, {"sql_notes", (char*) &sys_sql_notes, SHOW_BOOL}, {"sql_warnings", (char*) &sys_sql_warnings, SHOW_BOOL}, From 58cb2f317c4a684c8941a66bdf473170ade21582 Mon Sep 17 00:00:00 2001 From: "jimw@mysql.com" <> Date: Wed, 26 Apr 2006 17:09:41 -0700 Subject: [PATCH 8/9] Remove obsolete test --- mysql-test/r/user_var.result | 3 --- mysql-test/t/user_var.test | 2 -- 2 files changed, 5 deletions(-) diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result index 75a680e504d..7439f9132fb 100644 --- a/mysql-test/r/user_var.result +++ b/mysql-test/r/user_var.result @@ -215,9 +215,6 @@ select @@version; select @@global.version; @@global.version # -select @@session.VERSION; -@@session.VERSION -# set @first_var= NULL; create table t1 select @first_var; show create table t1; diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test index 61861c26ea8..e1b23a1782f 100644 --- a/mysql-test/t/user_var.test +++ b/mysql-test/t/user_var.test @@ -143,8 +143,6 @@ select @@Max_Allowed_Packet; select @@version; --replace_column 1 # select @@global.version; ---replace_column 1 # -select @@session.VERSION; # End of 4.1 tests From 31a428928e81e4d83f4382da7c796f047fa711e4 Mon Sep 17 00:00:00 2001 From: "jimw@mysql.com" <> Date: Wed, 26 Apr 2006 20:50:27 -0700 Subject: [PATCH 9/9] Fix bug in ndbcluster.sh on Solaris (now that line is the same as in 5.1) --- mysql-test/ndb/ndbcluster.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/ndb/ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh index 50eb3987a36..3710da71e10 100644 --- a/mysql-test/ndb/ndbcluster.sh +++ b/mysql-test/ndb/ndbcluster.sh @@ -237,7 +237,7 @@ cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile" # test if Ndb Cluster starts properly echo "Waiting for NDB data nodes to start..." -if ( $exec_waiter ) | grep -q "NDBT_ProgramExit: 0 - OK"; then :; else +if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK" > /dev/null 2>&1; then :; else echo "Ndbcluster startup failed" stop_default_ndbcluster exit 1