From 736998cb75ba1d7bf8969329d649d9d1337353ff Mon Sep 17 00:00:00 2001 From: Monty Date: Mon, 30 Dec 2019 14:11:31 +0200 Subject: Cleanups & indentation changes - Only indentation changes in sql_rename.cc - Ignore some WSREP error messages when there isn't a internet connection - Force restart of stat_tables_part.test to make result stable - Fixed compiler warnings in CONNECT --- mysql-test/include/not_windows.inc | 2 +- mysql-test/main/stat_tables_par.inc | 275 +++++++++++++++++++++++++ mysql-test/main/stat_tables_par.result | 1 + mysql-test/main/stat_tables_par.test | 279 +------------------------- mysql-test/main/stat_tables_par_innodb.result | 1 + mysql-test/main/stat_tables_par_innodb.test | 9 +- mysql-test/mysql-test-run.pl | 4 +- 7 files changed, 294 insertions(+), 277 deletions(-) create mode 100644 mysql-test/main/stat_tables_par.inc (limited to 'mysql-test') diff --git a/mysql-test/include/not_windows.inc b/mysql-test/include/not_windows.inc index 08373095438..035486025f2 100644 --- a/mysql-test/include/not_windows.inc +++ b/mysql-test/include/not_windows.inc @@ -1,4 +1,4 @@ # # suite.pm will make sure that all tests including this file -# will be skipped unless this is on Windows +# will be skipped if run under Windows # diff --git a/mysql-test/main/stat_tables_par.inc b/mysql-test/main/stat_tables_par.inc new file mode 100644 index 00000000000..fabb7c3e042 --- /dev/null +++ b/mysql-test/main/stat_tables_par.inc @@ -0,0 +1,275 @@ +# Note that this test requires a fresh restart to not have problems with the +# old status values + +set @save_use_stat_tables=@@use_stat_tables; + +set use_stat_tables='preferably'; + +--disable_warnings +DROP DATABASE IF EXISTS dbt3_s001; +--enable_warnings + +CREATE DATABASE dbt3_s001; + +use dbt3_s001; + +set @save_optimizer_switch=@@optimizer_switch; +set optimizer_switch='extended_keys=off'; + +--disable_query_log +--disable_result_log +--disable_warnings +--source include/dbt3_s001.inc +delete from mysql.table_stats; +delete from mysql.column_stats; +delete from mysql.index_stats; +ANALYZE TABLE +customer, lineitem, nation, orders, part, partsupp, region, supplier; +--enable_warnings +--enable_result_log +--enable_query_log + +select * from mysql.table_stats; +select * from mysql.index_stats; + + +# +# Test for parallel memory allocation for statistical data +# +# assumes that start the code of memory allocation for stats data has this line: +# +# DEBUG_SYNC(thd, "statistics_mem_alloc_start1"); +# DEBUG_SYNC(thd, "statistics_mem_alloc_start2"); +# + +let $Q6= +select round(sum(l_extendedprice*l_discount),4) as revenue +from lineitem +where l_shipdate >= date '1994-01-01' + and l_shipdate < date '1994-01-01' + interval '1' year + and l_discount between 0.06 - 0.01 and 0.06 + 0.01 + and l_quantity < 24; + +flush table lineitem; +set use_stat_tables='never'; +eval $Q6; + +connect (con1, localhost, root,,); +connect (con2, localhost, root,,); + +connection con1; +set debug_sync='statistics_mem_alloc_start1 WAIT_FOR second_thread_started_too'; +set debug_sync='statistics_mem_alloc_start2 SIGNAL first_thread_working'; +use dbt3_s001; +set use_stat_tables='preferably'; +--send_eval $Q6 + +connection con2; +set debug_sync='statistics_mem_alloc_start1 SIGNAL second_thread_started_too'; +set debug_sync='statistics_mem_alloc_start2 WAIT_FOR first_thread_working'; +use dbt3_s001; +set use_stat_tables='preferably'; +--send_eval $Q6 + +connection con1; +--reap + +connection con2; +--reap + +connection default; +set use_stat_tables='preferably'; +disconnect con1; +disconnect con2; +set debug_sync='RESET'; + +# +# Test for parallel statistics collection +# +# assumes that start of stats collection code has this line: +# +# DEBUG_SYNC(thd, "statistics_collection_start1"); +# DEBUG_SYNC(thd, "statistics_collection_start2"); +# + +select * from mysql.index_stats where table_name='lineitem' order by index_name; +delete from mysql.index_stats + where table_name='lineitem' and + index_name in ('i_l_shipdate', 'i_l_receiptdate'); +select * from mysql.index_stats where table_name='lineitem' order by index_name; +--disable_result_log +--disable_warnings +analyze table lineitem persistent for columns() indexes (i_l_shipdate); +--enable_warnings +--enable_result_log +select * from mysql.index_stats where table_name='lineitem' order by index_name; +delete from mysql.index_stats + where table_name='lineitem' and index_name= 'i_l_shipdate'; +select * from mysql.index_stats where table_name='lineitem' order by index_name; + +connect (con1, localhost, root,,); +connect (con2, localhost, root,,); + +connection con1; +set debug_sync='statistics_collection_start1 WAIT_FOR second_thread_started_too'; +set debug_sync='statistics_collection_start2 SIGNAL first_thread_working'; +use dbt3_s001; +set use_stat_tables='preferably'; +--send analyze table lineitem persistent for columns() indexes (i_l_shipdate) + +connection con2; +set debug_sync='statistics_collection_start1 SIGNAL second_thread_started_too'; +set debug_sync='statistics_collection_start2 WAIT_FOR first_thread_working'; +use dbt3_s001; +set use_stat_tables='preferably'; +--send analyze table lineitem persistent for columns() indexes (i_l_receiptdate) + +connection con1; +--disable_result_log +--disable_warnings +--reap +--enable_warnings +--enable_result_log + +connection con2; +--disable_result_log +--disable_warnings +--reap +--enable_warnings +--enable_result_log + +connection default; +disconnect con1; +disconnect con2; +set debug_sync='RESET'; + +select * from mysql.index_stats where table_name='lineitem' order by index_name, prefix_arity; + +# +# Test for parallel statistics collection and update (innodb) +# + +select * from mysql.index_stats where table_name='lineitem' + order by index_name, prefix_arity; +set debug_sync='RESET'; + +let $innodb_storage_engine= 0; +if (`SELECT UPPER(@@default_storage_engine) = 'INNODB'`) +{ + let $innodb_storage_engine= 1; +} + +connect (con1, localhost, root,,); +connect (con2, localhost, root,,); + +connection con1; +set debug_sync='statistics_collection_start SIGNAL parked WAIT_FOR finish'; +use dbt3_s001; +set use_stat_tables='preferably'; +--send analyze table lineitem persistent for all + +connection con2; +set debug_sync='now WAIT_FOR parked'; +use dbt3_s001; +set use_stat_tables='never'; +if ($innodb_storage_engine) +{ + select * from lineitem where l_orderkey=1 and l_partkey=156; + delete from lineitem where l_orderkey=1 and l_partkey=156; + select * from lineitem where l_orderkey=1 and l_partkey=156; +} +set debug_sync='now SIGNAL finish'; + +connection con1; +--disable_result_log +--disable_warnings +--reap +--enable_warnings +--enable_result_log + +connection default; +disconnect con1; +disconnect con2; +set debug_sync='RESET'; + +select * from mysql.index_stats where table_name='lineitem' + order by index_name, prefix_arity; + +# +# Bug mdev-3891: deadlock for ANALYZE and SELECT over mysql.index_stats +# + +set @save_global_use_stat_tables=@@global.use_stat_tables; +set global use_stat_tables='preferably'; +set debug_sync='RESET'; + +connect (con1, localhost, root,,); +connect (con2, localhost, root,,); + +connection con1; +set debug_sync='statistics_update_start SIGNAL parker WAIT_FOR go1 EXECUTE 1'; +set debug_sync='thr_multi_lock_before_thr_lock SIGNAL go2 EXECUTE 3'; +use dbt3_s001; +--send analyze table lineitem persistent for all + +connection con2; +set debug_sync='open_and_process_table WAIT_FOR parker'; +set debug_sync='statistics_read_start SIGNAL go1 WAIT_FOR go2'; +use dbt3_s001; +--send select * from mysql.index_stats, lineitem where index_name= 'i_l_shipdate' and l_orderkey=1 and l_partkey=68 order by prefix_arity; + +connection con1; +--disable_result_log +--disable_warnings +--reap +--enable_warnings +--enable_result_log + +connection con2; +--disable_warnings +--reap +--enable_warnings + +connection default; +disconnect con1; +disconnect con2; +set debug_sync='RESET'; + +set global use_stat_tables=@save_global_use_stat_tables; + +DROP DATABASE dbt3_s001; + +use test; + +# +# Bug mdev-4019: crash when executing in parallel ANALYZE and +# SELECT * FROM information_schema.statistics +# + +set @save_global_use_stat_tables=@@global.use_stat_tables; +set global use_stat_tables='preferably'; +set debug_sync='RESET'; + +create table t1 (a int, b int, key(a)); +insert t1 values (1,1),(2,2); + +analyze table t1; + +SET debug_sync='after_open_table_ignore_flush WAIT_FOR go'; +send select * from information_schema.statistics where table_schema='test'; + +connect(con1, localhost, root); +connection con1; +select * from t1; +SET DEBUG_SYNC= "now SIGNAL go"; + +connection default; +reap; + +connection default; +disconnect con1; +set debug_sync='RESET'; + +drop table t1; +set global use_stat_tables=@save_global_use_stat_tables; +set use_stat_tables=@save_use_stat_tables; diff --git a/mysql-test/main/stat_tables_par.result b/mysql-test/main/stat_tables_par.result index 09ee2bbf16a..33fbe079c9e 100644 --- a/mysql-test/main/stat_tables_par.result +++ b/mysql-test/main/stat_tables_par.result @@ -1,3 +1,4 @@ +# restart set @save_use_stat_tables=@@use_stat_tables; set use_stat_tables='preferably'; DROP DATABASE IF EXISTS dbt3_s001; diff --git a/mysql-test/main/stat_tables_par.test b/mysql-test/main/stat_tables_par.test index 383ea38fed4..5bad16075d4 100644 --- a/mysql-test/main/stat_tables_par.test +++ b/mysql-test/main/stat_tables_par.test @@ -1,278 +1,9 @@ +# Note that this test requires a fresh restart to not have problems with the +# old status values + --source include/have_stat_tables.inc --source include/have_debug_sync.inc --source include/not_embedded.inc +--source include/restart_mysqld.inc -set @save_use_stat_tables=@@use_stat_tables; - -set use_stat_tables='preferably'; - ---disable_warnings -DROP DATABASE IF EXISTS dbt3_s001; ---enable_warnings - -CREATE DATABASE dbt3_s001; - -use dbt3_s001; - -set @save_optimizer_switch=@@optimizer_switch; -set optimizer_switch='extended_keys=off'; - ---disable_query_log ---disable_result_log ---disable_warnings ---source include/dbt3_s001.inc -delete from mysql.table_stats; -delete from mysql.column_stats; -delete from mysql.index_stats; -ANALYZE TABLE -customer, lineitem, nation, orders, part, partsupp, region, supplier; ---enable_warnings ---enable_result_log ---enable_query_log - -select * from mysql.table_stats; -select * from mysql.index_stats; - - -# -# Test for parallel memory allocation for statistical data -# -# assumes that start the code of memory allocation for stats data has this line: -# -# DEBUG_SYNC(thd, "statistics_mem_alloc_start1"); -# DEBUG_SYNC(thd, "statistics_mem_alloc_start2"); -# - -let $Q6= -select round(sum(l_extendedprice*l_discount),4) as revenue -from lineitem -where l_shipdate >= date '1994-01-01' - and l_shipdate < date '1994-01-01' + interval '1' year - and l_discount between 0.06 - 0.01 and 0.06 + 0.01 - and l_quantity < 24; - -flush table lineitem; -set use_stat_tables='never'; -eval $Q6; - -connect (con1, localhost, root,,); -connect (con2, localhost, root,,); - -connection con1; -set debug_sync='statistics_mem_alloc_start1 WAIT_FOR second_thread_started_too'; -set debug_sync='statistics_mem_alloc_start2 SIGNAL first_thread_working'; -use dbt3_s001; -set use_stat_tables='preferably'; ---send_eval $Q6 - -connection con2; -set debug_sync='statistics_mem_alloc_start1 SIGNAL second_thread_started_too'; -set debug_sync='statistics_mem_alloc_start2 WAIT_FOR first_thread_working'; -use dbt3_s001; -set use_stat_tables='preferably'; ---send_eval $Q6 - -connection con1; ---reap - -connection con2; ---reap - -connection default; -set use_stat_tables='preferably'; -disconnect con1; -disconnect con2; -set debug_sync='RESET'; - -# -# Test for parallel statistics collection -# -# assumes that start of stats collection code has this line: -# -# DEBUG_SYNC(thd, "statistics_collection_start1"); -# DEBUG_SYNC(thd, "statistics_collection_start2"); -# - -select * from mysql.index_stats where table_name='lineitem' order by index_name; -delete from mysql.index_stats - where table_name='lineitem' and - index_name in ('i_l_shipdate', 'i_l_receiptdate'); -select * from mysql.index_stats where table_name='lineitem' order by index_name; ---disable_result_log ---disable_warnings -analyze table lineitem persistent for columns() indexes (i_l_shipdate); ---enable_warnings ---enable_result_log -select * from mysql.index_stats where table_name='lineitem' order by index_name; -delete from mysql.index_stats - where table_name='lineitem' and index_name= 'i_l_shipdate'; -select * from mysql.index_stats where table_name='lineitem' order by index_name; - -connect (con1, localhost, root,,); -connect (con2, localhost, root,,); - -connection con1; -set debug_sync='statistics_collection_start1 WAIT_FOR second_thread_started_too'; -set debug_sync='statistics_collection_start2 SIGNAL first_thread_working'; -use dbt3_s001; -set use_stat_tables='preferably'; ---send analyze table lineitem persistent for columns() indexes (i_l_shipdate) - -connection con2; -set debug_sync='statistics_collection_start1 SIGNAL second_thread_started_too'; -set debug_sync='statistics_collection_start2 WAIT_FOR first_thread_working'; -use dbt3_s001; -set use_stat_tables='preferably'; ---send analyze table lineitem persistent for columns() indexes (i_l_receiptdate) - -connection con1; ---disable_result_log ---disable_warnings ---reap ---enable_warnings ---enable_result_log - -connection con2; ---disable_result_log ---disable_warnings ---reap ---enable_warnings ---enable_result_log - -connection default; -disconnect con1; -disconnect con2; -set debug_sync='RESET'; - -select * from mysql.index_stats where table_name='lineitem' order by index_name, prefix_arity; - -# -# Test for parallel statistics collection and update (innodb) -# - -select * from mysql.index_stats where table_name='lineitem' - order by index_name, prefix_arity; -set debug_sync='RESET'; - -let $innodb_storage_engine= 0; -if (`SELECT UPPER(@@default_storage_engine) = 'INNODB'`) -{ - let $innodb_storage_engine= 1; -} - -connect (con1, localhost, root,,); -connect (con2, localhost, root,,); - -connection con1; -set debug_sync='statistics_collection_start SIGNAL parked WAIT_FOR finish'; -use dbt3_s001; -set use_stat_tables='preferably'; ---send analyze table lineitem persistent for all - -connection con2; -set debug_sync='now WAIT_FOR parked'; -use dbt3_s001; -set use_stat_tables='never'; -if ($innodb_storage_engine) -{ - select * from lineitem where l_orderkey=1 and l_partkey=156; - delete from lineitem where l_orderkey=1 and l_partkey=156; - select * from lineitem where l_orderkey=1 and l_partkey=156; -} -set debug_sync='now SIGNAL finish'; - -connection con1; ---disable_result_log ---disable_warnings ---reap ---enable_warnings ---enable_result_log - -connection default; -disconnect con1; -disconnect con2; -set debug_sync='RESET'; - -select * from mysql.index_stats where table_name='lineitem' - order by index_name, prefix_arity; - -# -# Bug mdev-3891: deadlock for ANALYZE and SELECT over mysql.index_stats -# - -set @save_global_use_stat_tables=@@global.use_stat_tables; -set global use_stat_tables='preferably'; -set debug_sync='RESET'; - -connect (con1, localhost, root,,); -connect (con2, localhost, root,,); - -connection con1; -set debug_sync='statistics_update_start SIGNAL parker WAIT_FOR go1 EXECUTE 1'; -set debug_sync='thr_multi_lock_before_thr_lock SIGNAL go2 EXECUTE 3'; -use dbt3_s001; ---send analyze table lineitem persistent for all - -connection con2; -set debug_sync='open_and_process_table WAIT_FOR parker'; -set debug_sync='statistics_read_start SIGNAL go1 WAIT_FOR go2'; -use dbt3_s001; ---send select * from mysql.index_stats, lineitem where index_name= 'i_l_shipdate' and l_orderkey=1 and l_partkey=68 order by prefix_arity; - -connection con1; ---disable_result_log ---disable_warnings ---reap ---enable_warnings ---enable_result_log - -connection con2; ---disable_warnings ---reap ---enable_warnings - -connection default; -disconnect con1; -disconnect con2; -set debug_sync='RESET'; - -set global use_stat_tables=@save_global_use_stat_tables; - -DROP DATABASE dbt3_s001; - -use test; - -# -# Bug mdev-4019: crash when executing in parallel ANALYZE and -# SELECT * FROM information_schema.statistics -# - -set @save_global_use_stat_tables=@@global.use_stat_tables; -set global use_stat_tables='preferably'; -set debug_sync='RESET'; - -create table t1 (a int, b int, key(a)); -insert t1 values (1,1),(2,2); - -analyze table t1; - -SET debug_sync='after_open_table_ignore_flush WAIT_FOR go'; -send select * from information_schema.statistics where table_schema='test'; - -connect(con1, localhost, root); -connection con1; -select * from t1; -SET DEBUG_SYNC= "now SIGNAL go"; - -connection default; -reap; - -connection default; -disconnect con1; -set debug_sync='RESET'; - -drop table t1; -set global use_stat_tables=@save_global_use_stat_tables; - - -set use_stat_tables=@save_use_stat_tables; +--source stat_tables_par.inc diff --git a/mysql-test/main/stat_tables_par_innodb.result b/mysql-test/main/stat_tables_par_innodb.result index c0b8bc378b6..c33785a9436 100644 --- a/mysql-test/main/stat_tables_par_innodb.result +++ b/mysql-test/main/stat_tables_par_innodb.result @@ -1,3 +1,4 @@ +# restart SET SESSION DEFAULT_STORAGE_ENGINE='InnoDB'; set @save_optimizer_switch_for_stat_tables_test=@@optimizer_switch; set optimizer_switch='extended_keys=on'; diff --git a/mysql-test/main/stat_tables_par_innodb.test b/mysql-test/main/stat_tables_par_innodb.test index 69adeeb7dc4..79ab23dcc3f 100644 --- a/mysql-test/main/stat_tables_par_innodb.test +++ b/mysql-test/main/stat_tables_par_innodb.test @@ -1,11 +1,18 @@ +# Note that this test requires a fresh restart to not have problems with the +# old status values + +--source include/have_stat_tables.inc +--source include/have_debug_sync.inc +--source include/not_embedded.inc --source include/have_innodb.inc +--source include/restart_mysqld.inc SET SESSION DEFAULT_STORAGE_ENGINE='InnoDB'; set @save_optimizer_switch_for_stat_tables_test=@@optimizer_switch; set optimizer_switch='extended_keys=on'; ---source stat_tables_par.test +--source stat_tables_par.inc set optimizer_switch=@save_optimizer_switch_for_stat_tables_test; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index d36370c4cac..b18924b8edc 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -4779,7 +4779,9 @@ sub extract_warning_lines ($$) { qr/InnoDB: Table .*mysql.*innodb_table_stats.* not found./, qr/InnoDB: User stopword table .* does not exist./, qr/Dump thread [0-9]+ last sent to server [0-9]+ binlog file:pos .+/, - qr/Detected table cache mutex contention at instance .* waits. Additional table cache instance cannot be activated: consider raising table_open_cache_instances. Number of active instances/ + qr/Detected table cache mutex contention at instance .* waits. Additional table cache instance cannot be activated: consider raising table_open_cache_instances. Number of active instances/, + qr/WSREP: Failed to guess base node address/, + qr/WSREP: Guessing address for incoming client/, ); my $matched_lines= []; -- cgit v1.2.1