From 9cba6c5aa3b15fffc0ca10e92bcb55a126a20701 Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 30 Aug 2019 16:06:54 +0300 Subject: Updated mtr files to support different compiled in options This allows one to run the test suite even if any of the following options are changed: - character-set-server - collation-server - join-cache-level - log-basename - max-allowed-packet - optimizer-switch - query-cache-size and query-cache-type - skip-name-resolve - table-definition-cache - table-open-cache - Some innodb options etc Changes: - Don't print out the value of system variables as one can't depend on them to being constants. - Don't set global variables to 'default' as the default may not be the same as the test was started with if there was an additional option file. Instead save original value and reset it at end of test. - Test that depends on the latin1 character set should include default_charset.inc or set the character set to latin1 - Test that depends on the original optimizer switch, should include default_optimizer_switch.inc - Test that depends on the value of a specific system variable should set it in the test (like optimizer_use_condition_selectivity) - Split subselect3.test into subselect3.test and subselect3.inc to make it easier to set and reset system variables. - Added .opt files for test that required specfic options that could be changed by external configuration files. - Fixed result files in rockdsb & tokudb that had not been updated for a while. --- mysql-test/include/alter_table_mdev539.inc | 4 +++- mysql-test/include/common-tests.inc | 10 +++++++--- mysql-test/include/ctype_utf8mb4.inc | 3 +++ mysql-test/include/default_charset.inc | 15 +++++++++++++++ mysql-test/include/default_group_order.cnf | 11 +++++++++++ mysql-test/include/default_my.cnf | 1 + mysql-test/include/default_mysqld.cnf | 1 - mysql-test/include/default_optimizer_switch.inc | 18 ++++++++++++++++++ mysql-test/include/grant_cache.inc | 11 ++++++++--- mysql-test/include/have_hostname_cache.inc | 6 ++++++ mysql-test/include/restore_charset.inc | 13 +++++++++++++ 11 files changed, 85 insertions(+), 8 deletions(-) create mode 100644 mysql-test/include/default_charset.inc create mode 100644 mysql-test/include/default_group_order.cnf create mode 100644 mysql-test/include/default_optimizer_switch.inc create mode 100644 mysql-test/include/have_hostname_cache.inc create mode 100644 mysql-test/include/restore_charset.inc (limited to 'mysql-test/include') diff --git a/mysql-test/include/alter_table_mdev539.inc b/mysql-test/include/alter_table_mdev539.inc index 66b32473961..ea6d19dfe33 100644 --- a/mysql-test/include/alter_table_mdev539.inc +++ b/mysql-test/include/alter_table_mdev539.inc @@ -2,6 +2,8 @@ --echo # mdev-539: fast build of unique/primary indexes for MyISAM/Aria --echo # +--source include/default_charset.inc + call mtr.add_suppression("Can't find record in '.*'"); --disable_warnings @@ -62,6 +64,6 @@ insert into customer values alter ignore table customer add primary key (c_custkey); show create table customer; select * from customer where c_custkey=3; - +--source include/restore_charset.inc DROP DATABASE dbt3_s001; diff --git a/mysql-test/include/common-tests.inc b/mysql-test/include/common-tests.inc index 204b6d4dd6b..347760bf3c0 100644 --- a/mysql-test/include/common-tests.inc +++ b/mysql-test/include/common-tests.inc @@ -1537,8 +1537,10 @@ select t2.fld1,t22.fld1 from t2,t2 t22 where t2.fld1 >= 250501 and t2.fld1 <= 25 # Test of left join. # -SET @save_optimizer_switch=@@optimizer_switch; -SET optimizer_switch='outer_join_with_cache=off'; +SET @local_optimizer_switch=@@optimizer_switch; +set @local_join_cache_level=@@join_cache_level; +set @@join_cache_level=2; +set optimizer_switch='outer_join_with_cache=off,join_cache_hashed=off'; insert into t2 (fld1, companynr) values (999999,99); @@ -1572,7 +1574,7 @@ explain select companynr,companyname from t4 left join t2 using (companynr) wher explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0 or companynr > 0; explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0; -SET optimizer_switch=@save_optimizer_switch; +SET @@optimizer_switch=@local_optimizer_switch; # # Joins with forms. @@ -1581,6 +1583,8 @@ SET optimizer_switch=@save_optimizer_switch; select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1; explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1; +SET @@join_cache_level=@local_join_cache_level; + # # Search using 'or' with the same referens group. # An interval search will be done first with the first table and after that diff --git a/mysql-test/include/ctype_utf8mb4.inc b/mysql-test/include/ctype_utf8mb4.inc index 2d48f9373f6..edd58ee32e7 100644 --- a/mysql-test/include/ctype_utf8mb4.inc +++ b/mysql-test/include/ctype_utf8mb4.inc @@ -1,6 +1,7 @@ # # Tests with the utf8mb4 character set # +--source include/default_optimizer_switch.inc --disable_warnings drop table if exists t1,t2; --enable_warnings @@ -1242,7 +1243,9 @@ drop table t1; # SET CHARACTER SET utf8mb4; +--source include/default_charset.inc SHOW VARIABLES LIKE 'character\_set\_%'; +SET @@character_set_server=@save_character_set_server; CREATE DATABASE crashtest DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; USE crashtest; eval CREATE TABLE crashtest (crash char(10)) DEFAULT CHARSET=utf8mb4 ENGINE $engine; diff --git a/mysql-test/include/default_charset.inc b/mysql-test/include/default_charset.inc new file mode 100644 index 00000000000..e5c40100c37 --- /dev/null +++ b/mysql-test/include/default_charset.inc @@ -0,0 +1,15 @@ +# This file sets the default character set that most test expects. + +# In most cases the variables should match the community server defaults. +# The values should be changed if the default character set for the server +# changes and all tests have been updated to supported the new character set + +# The purpose if this file is to allow users to change these defaults +# without having to update all tests. + +--disable_query_log +SET @save_character_set_server= @@character_set_server; +SET @save_collation_server= @@collation_server; +set @@character_set_server="latin1"; +set @@collation_server="latin1_swedish_ci"; +--enable_query_log diff --git a/mysql-test/include/default_group_order.cnf b/mysql-test/include/default_group_order.cnf new file mode 100644 index 00000000000..a4e84ec2c55 --- /dev/null +++ b/mysql-test/include/default_group_order.cnf @@ -0,0 +1,11 @@ +# Define the order that mtr will save groups in the generated my.cnf files +# The --debug-gdb option is just here to force mtr to remember the group order + +[mysqld] +#debug-gdb= +[mariadb] +#debug-gdb= +[embedded] +#debug-gdb= +[server] +#debug-gdb= diff --git a/mysql-test/include/default_my.cnf b/mysql-test/include/default_my.cnf index a46e748daa0..d102c9020cc 100644 --- a/mysql-test/include/default_my.cnf +++ b/mysql-test/include/default_my.cnf @@ -15,6 +15,7 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA # Use default setting for mysqld processes +!include default_group_order.cnf !include default_mysqld.cnf !include default_client.cnf diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf index 568881ef57e..7ef235fcd3b 100644 --- a/mysql-test/include/default_mysqld.cnf +++ b/mysql-test/include/default_mysqld.cnf @@ -127,4 +127,3 @@ local-infile # tables. Let's enable it in the [server] group, because this group # is read after [mysqld] and [embedded] loose-aria - diff --git a/mysql-test/include/default_optimizer_switch.inc b/mysql-test/include/default_optimizer_switch.inc new file mode 100644 index 00000000000..f09e272f6eb --- /dev/null +++ b/mysql-test/include/default_optimizer_switch.inc @@ -0,0 +1,18 @@ +# This file sets the default optimizer flags and optimizer variables that +# most test expects. In most cases the variables should match the community +# server defaults. +# The purpose if this file is to allow users to change these defaults +# without having to update all tests. + +--disable_query_log +set @save_optimizer_switch=@@optimizer_switch; +set @save_join_cache_level=@@join_cache_level; + +set optimizer_switch="index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on"; + +set optimizer_use_condition_selectivity=1; +set optimizer_search_depth=62; +set join_buffer_space_limit=2097152; +set join_cache_level=2; +set join_buffer_size=262144; +--enable_query_log diff --git a/mysql-test/include/grant_cache.inc b/mysql-test/include/grant_cache.inc index cb495e7feae..467c1170563 100644 --- a/mysql-test/include/grant_cache.inc +++ b/mysql-test/include/grant_cache.inc @@ -37,8 +37,13 @@ --source include/add_anonymous_users.inc +set @save_query_cache_size=@@global.query_cache_size; +set @save_sql_mode=@@global.sql_mode; +set @save_query_cache_type=@@global.query_cache_type; + set GLOBAL sql_mode=""; set LOCAL sql_mode=""; + # --disable_warnings drop table if exists test.t1,mysqltest.t1,mysqltest.t2; @@ -208,10 +213,10 @@ flush privileges; drop table test.t1,mysqltest.t1,mysqltest.t2; drop database mysqltest; -set GLOBAL query_cache_size=default; set GLOBAL query_cache_type=ON; set LOCAL query_cache_type=ON; --source include/delete_anonymous_users.inc -set GLOBAL sql_mode=default; -set GLOBAL query_cache_type=default; +set GLOBAL query_cache_size=@save_query_cache_size; +set GLOBAL sql_mode=@save_sql_mode; +set GLOBAL query_cache_type=@save_query_cache_type; diff --git a/mysql-test/include/have_hostname_cache.inc b/mysql-test/include/have_hostname_cache.inc new file mode 100644 index 00000000000..b6c7c6bd6a6 --- /dev/null +++ b/mysql-test/include/have_hostname_cache.inc @@ -0,0 +1,6 @@ +# Ensure that host_cache is enabled + +if (`SELECT @@skip_name_resolve != "OFF"`) +{ + skip No hostname_cache; +} diff --git a/mysql-test/include/restore_charset.inc b/mysql-test/include/restore_charset.inc new file mode 100644 index 00000000000..afd87838e56 --- /dev/null +++ b/mysql-test/include/restore_charset.inc @@ -0,0 +1,13 @@ +# This file sets the default character set that most test expects. + +# In most cases the variables should match the community server defaults. +# The values should be changed if the default character set for the server +# changes and all tests have been updated to supported the new character set + +# The purpose if this file is to allow users to change these defaults +# without having to update all tests. + +--disable_query_log +SET @@character_set_server=@save_character_set_server; +SET @@collation_server=@save_collation_server; +--enable_query_log -- cgit v1.2.1