diff options
Diffstat (limited to 'mysql-test/include')
47 files changed, 693 insertions, 83 deletions
diff --git a/mysql-test/include/binlog_inject_error.inc b/mysql-test/include/binlog_inject_error.inc new file mode 100644 index 00000000000..6465f7943a4 --- /dev/null +++ b/mysql-test/include/binlog_inject_error.inc @@ -0,0 +1,22 @@ +# +# === Name +# +# binlog_inject_error.inc +# +# === Description +# +# Inject binlog write error when running the query, verifies that the +# query is ended with the proper error (ER_ERROR_ON_WRITE). +# +# === Usage +# +# let query= 'CREATE TABLE t1 (a INT)'; +# source include/binlog_inject_error.inc; +# + +SET GLOBAL debug='d,injecting_fault_writing'; +--echo $query; +--replace_regex /(errno: .*)/(errno: #)/ +--error ER_ERROR_ON_WRITE +--eval $query +SET GLOBAL debug=''; diff --git a/mysql-test/include/bug38347.inc b/mysql-test/include/bug38347.inc new file mode 100644 index 00000000000..ca1dbfa1bd2 --- /dev/null +++ b/mysql-test/include/bug38347.inc @@ -0,0 +1,21 @@ + +--echo +SHOW GRANTS FOR mysqltest_u1@localhost; + +--echo +--echo # connection: con1 (mysqltest_u1@mysqltest_db1) +--connect (con1,localhost,mysqltest_u1,,mysqltest_db1) +--connection con1 + +--echo +SHOW CREATE TABLE t1; + +--echo +--echo # connection: default +--connection default + +--disconnect con1 + +--echo +REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; +SHOW GRANTS FOR mysqltest_u1@localhost; diff --git a/mysql-test/include/check_ipv6.inc b/mysql-test/include/check_ipv6.inc new file mode 100644 index 00000000000..14d04b11e83 --- /dev/null +++ b/mysql-test/include/check_ipv6.inc @@ -0,0 +1,14 @@ +# Check if ipv6 is available. If not, server is crashing (see BUG#48915). +--disable_query_log +--disable_abort_on_error +connect (checkcon123456789,::1,root,,test); +if($mysql_errno) +{ +skip wrong IP; +} +connection default; +disconnect checkcon123456789; +--enable_abort_on_error +--enable_query_log +# end check + diff --git a/mysql-test/include/check_key_reads.inc b/mysql-test/include/check_key_reads.inc new file mode 100644 index 00000000000..cfb754bccd4 --- /dev/null +++ b/mysql-test/include/check_key_reads.inc @@ -0,0 +1,6 @@ +# include file for checking if variable key_reads is zero +let $key_reads= query_get_value(SHOW STATUS LIKE 'key_reads',Value,1); +--disable_query_log +eval SELECT IF($key_reads = 0, "Yes!", "No!") as 'Zero key reads?'; +FLUSH STATUS; +--enable_query_log diff --git a/mysql-test/include/check_key_req.inc b/mysql-test/include/check_key_req.inc new file mode 100644 index 00000000000..92a81f09d91 --- /dev/null +++ b/mysql-test/include/check_key_req.inc @@ -0,0 +1,9 @@ +# include file for checking if variable key_reads = key_read_requests +let $key_reads= query_get_value(SHOW STATUS LIKE 'key_reads',Value,1); +let $key_r_req= query_get_value(SHOW STATUS LIKE 'key_read_requests',Value,1); +let $key_writes= query_get_value(SHOW STATUS LIKE 'key_writes',Value,1); +let $key_w_req= query_get_value(SHOW STATUS LIKE 'key_write_requests',Value,1); +--disable_query_log +eval SELECT IF($key_reads = $key_r_req, "reads == requests", "reads != requests") as 'reads vs requests'; +eval SELECT IF($key_writes = $key_w_req, "writes == requests", "writes != requests") as 'writes vs requests'; +--enable_query_log diff --git a/mysql-test/include/commit.inc b/mysql-test/include/commit.inc index d91ba8291fd..4336d3be0ed 100644 --- a/mysql-test/include/commit.inc +++ b/mysql-test/include/commit.inc @@ -547,9 +547,9 @@ call p_verify_status_increment(0, 0, 0, 0); --echo # the binary log. --echo # select f1(); -call p_verify_status_increment(0, 0, 1, 0); +call p_verify_status_increment(1, 0, 1, 0); commit; -call p_verify_status_increment(0, 0, 1, 0); +call p_verify_status_increment(1, 0, 1, 0); --echo # 17. Read-only statement, a function changes non-trans-table. --echo # @@ -557,15 +557,19 @@ call p_verify_status_increment(0, 0, 1, 0); --echo # non-transactional changes saved in the transaction cache to --echo # the binary log. --echo # +--disable_warnings select f1() from t1; -call p_verify_status_increment(1, 0, 2, 0); +--enable_warnings +call p_verify_status_increment(2, 0, 2, 0); commit; -call p_verify_status_increment(1, 0, 2, 0); +call p_verify_status_increment(2, 0, 2, 0); --echo # 18. Read-write statement: UPDATE, change 0 (transactional) rows. --echo # select count(*) from t2; +--disable_warnings update t1 set a=2 where a=f1()+10; +--enable_warnings select count(*) from t2; call p_verify_status_increment(2, 0, 2, 0); commit; @@ -579,7 +583,7 @@ call p_verify_status_increment(2, 0, 2, 0); drop table t2; set sql_mode=no_engine_substitution; create temporary table t2 (a int); -call p_verify_status_increment(0, 0, 0, 0); +call p_verify_status_increment(1, 0, 0, 0); set sql_mode=default; --echo # 19. A function changes temp-trans-table. --echo # @@ -636,9 +640,9 @@ call p_verify_status_increment(2, 0, 1, 0); --echo # 25. DDL: DROP TEMPORARY TABLE, does not start a transaction --echo # drop temporary table t2; -call p_verify_status_increment(0, 0, 0, 0); +call p_verify_status_increment(1, 0, 0, 0); commit; -call p_verify_status_increment(0, 0, 0, 0); +call p_verify_status_increment(1, 0, 0, 0); --echo # 26. Verify that SET AUTOCOMMIT issues an implicit commit --echo # @@ -719,17 +723,17 @@ call p_verify_status_increment(4, 4, 4, 4); --echo # Sic: no table is created. create table if not exists t2 (a int) select 6 union select 7; --echo # Sic: first commits the statement, and then the transaction. -call p_verify_status_increment(4, 4, 4, 4); +call p_verify_status_increment(2, 0, 4, 4); create table t3 select a from t2; -call p_verify_status_increment(4, 4, 4, 4); +call p_verify_status_increment(2, 0, 4, 4); alter table t3 add column (b int); call p_verify_status_increment(2, 0, 2, 0); alter table t3 rename t4; -call p_verify_status_increment(2, 2, 2, 2); +call p_verify_status_increment(1, 0, 1, 0); rename table t4 to t3; -call p_verify_status_increment(2, 2, 2, 2); +call p_verify_status_increment(1, 0, 1, 0); truncate table t3; -call p_verify_status_increment(4, 4, 4, 4); +call p_verify_status_increment(2, 0, 2, 0); create view v1 as select * from t2; call p_verify_status_increment(1, 0, 1, 0); check table t1; diff --git a/mysql-test/include/ddl_i18n.check_sp.inc b/mysql-test/include/ddl_i18n.check_sp.inc index bb1657d7072..c182f797847 100644 --- a/mysql-test/include/ddl_i18n.check_sp.inc +++ b/mysql-test/include/ddl_i18n.check_sp.inc @@ -36,19 +36,19 @@ SHOW PROCEDURE STATUS LIKE 'p4'| --echo --echo ---replace_column 16 CREATED 17 ALTERED +--replace_column 23 CREATED 24 ALTERED SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p1'| --echo ---replace_column 16 CREATED 17 ALTERED +--replace_column 23 CREATED 24 ALTERED SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p2'| --echo ---replace_column 16 CREATED 17 ALTERED +--replace_column 23 CREATED 24 ALTERED SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p3'| --echo ---replace_column 16 CREATED 17 ALTERED +--replace_column 23 CREATED 24 ALTERED SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p4'| # - Initialize the used variables (actual values don't matter); diff --git a/mysql-test/include/default_client.cnf b/mysql-test/include/default_client.cnf new file mode 100644 index 00000000000..38f0d39127a --- /dev/null +++ b/mysql-test/include/default_client.cnf @@ -0,0 +1,19 @@ +# +# We use default-character-set=latin1 to avoid character set auto-detection +# when running tests - not to depend on the current machine localization. +# + +[mysql] +default-character-set=latin1 + +[mysqlshow] +default-character-set=latin1 + +[mysqlimport] +default-character-set=latin1 + +[mysqlcheck] +default-character-set=latin1 + +[mysql_upgrade] +default-character-set=latin1 diff --git a/mysql-test/include/default_my.cnf b/mysql-test/include/default_my.cnf index d77fee0e200..6888a69b0a4 100644 --- a/mysql-test/include/default_my.cnf +++ b/mysql-test/include/default_my.cnf @@ -1,5 +1,21 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# 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 +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # Use default setting for mysqld processes !include default_mysqld.cnf +!include default_client.cnf [mysqld.1] @@ -8,6 +24,8 @@ log-bin= master-bin +# Run tests with the performance schema instrumentation +loose-enable-performance-schema [mysqlbinlog] disable-force-if-open diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf index ad0090aaf36..def14abf55a 100644 --- a/mysql-test/include/default_mysqld.cnf +++ b/mysql-test/include/default_mysqld.cnf @@ -1,3 +1,18 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# 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 +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # Default values that applies to all MySQL Servers [mysqld] open-files-limit= 1024 @@ -14,8 +29,18 @@ sort_buffer= 256K max_heap_table_size= 1M loose-innodb_data_file_path= ibdata1:10M:autoextend +loose-innodb_buffer_pool_size= 8M +loose-innodb_write_io_threads= 2 +loose-innodb_read_io_threads= 2 +loose-innodb_log_buffer_size= 1M +loose-innodb_log_file_size= 5M +loose-innodb_additional_mem_pool_size= 1M +loose-innodb_log_files_in_group= 2 slave-net-timeout=120 log-bin=mysqld-bin +# Run tests with the performance schema instrumentation +loose-enable-performance-schema + diff --git a/mysql-test/include/diff_tables.inc b/mysql-test/include/diff_tables.inc index d15dd56b35d..ad42615511a 100644 --- a/mysql-test/include/diff_tables.inc +++ b/mysql-test/include/diff_tables.inc @@ -60,6 +60,7 @@ disable_query_log; --error 0,1 --remove_file $MYSQLTEST_VARDIR/tmp/diff_table_2 + let $_diff_table=$diff_table_2; let $_diff_i=2; while ($_diff_i) { diff --git a/mysql-test/include/have_community_features.inc b/mysql-test/include/have_community_features.inc deleted file mode 100644 index 66697d8dd00..00000000000 --- a/mysql-test/include/have_community_features.inc +++ /dev/null @@ -1,4 +0,0 @@ ---require r/have_community_features.require ---disable_query_log -show variables like 'have_community_features'; ---enable_query_log diff --git a/mysql-test/include/have_dynamic_loading.inc b/mysql-test/include/have_dynamic_loading.inc index 1b2c85b3904..3ce9641d87c 100644 --- a/mysql-test/include/have_dynamic_loading.inc +++ b/mysql-test/include/have_dynamic_loading.inc @@ -1,7 +1,9 @@ # # Whether server supports dynamic loading. # ---require r/have_dynamic_loading.require +if (`SELECT @@have_dynamic_loading != 'YES'`) { + --skip The test requires dynamic loading +} disable_query_log; show variables like 'have_dynamic_loading'; enable_query_log; diff --git a/mysql-test/include/have_example_plugin.inc b/mysql-test/include/have_example_plugin.inc index a2fffc17b97..3a667d2e21a 100644 --- a/mysql-test/include/have_example_plugin.inc +++ b/mysql-test/include/have_example_plugin.inc @@ -1,13 +1,21 @@ # -# Check if server has support for loading udf's -# i.e it will support dlopen +# Check if server has support for loading plugins # ---source include/have_dynamic_loading.inc +if (`SELECT @@have_dynamic_loading != 'YES'`) { + --skip Example plugin requires dynamic loading +} # # Check if the variable EXAMPLE_PLUGIN is set # ---require r/have_example_plugin.require -disable_query_log; -eval select LENGTH('$EXAMPLE_PLUGIN') > 0 as 'have_example_plugin'; +if (`SELECT LENGTH('$EXAMPLE_PLUGIN') = 0`) { + --skip Example plugin requires the environment variable \$EXAMPLE_PLUGIN to be set (normally done by mtr) +} + +# +# Check if --plugin-dir was setup for exampledb +# +if (`SELECT CONCAT('--plugin-dir=', @@plugin_dir) != '$EXAMPLE_PLUGIN_OPT'`) { + --skip Example plugin requires that --plugin-dir is set to the example plugin dir (either the .opt file does not contain \$EXAMPLE_PLUGIN_OPT or another plugin is in use) +} enable_query_log; diff --git a/mysql-test/include/have_nodebug.inc b/mysql-test/include/have_nodebug.inc new file mode 100644 index 00000000000..3a5b073cd2e --- /dev/null +++ b/mysql-test/include/have_nodebug.inc @@ -0,0 +1,4 @@ +-- require r/have_nodebug.require +disable_query_log; +select (version() like '%debug%') as debug; +enable_query_log; diff --git a/mysql-test/include/have_perfschema.inc b/mysql-test/include/have_perfschema.inc new file mode 100644 index 00000000000..6d52a53b6b1 --- /dev/null +++ b/mysql-test/include/have_perfschema.inc @@ -0,0 +1,20 @@ +# Copyright (C) 2010 Sun Microsystems, Inc. +# +# 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 +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +if (!`SELECT count(*) FROM information_schema.engines WHERE + (support = 'YES' OR support = 'DEFAULT') AND + engine = 'PERFORMANCE_SCHEMA'`){ + skip Need performance schema compiled in; +} diff --git a/mysql-test/include/have_profiling.inc b/mysql-test/include/have_profiling.inc new file mode 100644 index 00000000000..48f6668ff92 --- /dev/null +++ b/mysql-test/include/have_profiling.inc @@ -0,0 +1,4 @@ +--require r/have_profiling.require +--disable_query_log +show variables like 'have_profiling'; +--enable_query_log diff --git a/mysql-test/include/have_semisync_plugin.inc b/mysql-test/include/have_semisync_plugin.inc new file mode 100644 index 00000000000..d3b42dbf5fb --- /dev/null +++ b/mysql-test/include/have_semisync_plugin.inc @@ -0,0 +1,21 @@ +# +# Check if server has support for loading plugins +# +if (`SELECT @@have_dynamic_loading != 'YES'`) { + --skip Requires dynamic loading +} + +# +# Check if the variable SEMISYNC_MASTER_PLUGIN is set +# +if (`select LENGTH('$SEMISYNC_MASTER_PLUGIN') = 0`) +{ + skip Need semisync plugins; +} + +# +# Check if --plugin-dir was setup for semisync +# +if (`SELECT CONCAT('--plugin-dir=', @@plugin_dir) != '$SEMISYNC_PLUGIN_OPT'`) { + --skip SEMISYNC plugin requires that --plugin-dir is set to the semisync plugin dir (either the .opt file does not contain \$SEMISYNC_PLUGIN_OPT or another plugin is in use) +} diff --git a/mysql-test/include/have_simple_parser.inc b/mysql-test/include/have_simple_parser.inc index 5a4dc93ec81..745f68603fe 100644 --- a/mysql-test/include/have_simple_parser.inc +++ b/mysql-test/include/have_simple_parser.inc @@ -1,13 +1,20 @@ # -# Check if server has support for loading udf's -# i.e it will support dlopen +# Check if server has support for loading plugins # ---source include/have_dynamic_loading.inc +if (`SELECT @@have_dynamic_loading != 'YES'`) { + --skip simple parser requires dynamic loading +} # # Check if the variable SIMPLE_PARSER is set # ---require r/have_simple_parser.require -disable_query_log; -eval select LENGTH('$SIMPLE_PARSER') > 0 as 'have_simple_parser'; -enable_query_log; +if (`SELECT LENGTH('$SIMPLE_PARSER') = 0`) { + --skip simple parser requires the environment variable \$SIMPLE_PARSER to be set (normally done by mtr) +} + +# +# Check if --plugin-dir was setup for simple parser +# +if (`SELECT CONCAT('--plugin-dir=', @@plugin_dir) != '$SIMPLE_PARSER_OPT'`) { + --skip simple parser requires that --plugin-dir is set to the udf plugin dir (either the .opt file does not contain \$UDF_EXAMPLE_LIB_OPT or another plugin is in use) +} diff --git a/mysql-test/include/have_ssl_communication.inc b/mysql-test/include/have_ssl_communication.inc new file mode 100644 index 00000000000..6f2d5587a75 --- /dev/null +++ b/mysql-test/include/have_ssl_communication.inc @@ -0,0 +1,4 @@ +-- require r/have_ssl.require +disable_query_log; +show variables like 'have_ssl'; +enable_query_log; diff --git a/mysql-test/include/have_thread_concurrency.inc b/mysql-test/include/have_thread_concurrency.inc new file mode 100644 index 00000000000..730edbf4895 --- /dev/null +++ b/mysql-test/include/have_thread_concurrency.inc @@ -0,0 +1,10 @@ +disable_query_log; +disable_result_log; +set @have_thread_concurrency=0; +select @have_thread_concurrency:=1 from information_schema.global_variables where variable_name='thread_concurrency'; +if (`select @have_thread_concurrency = 0`) +{ + skip Need @@thread_concurrency; +} +enable_result_log; +enable_query_log; diff --git a/mysql-test/include/have_udf.inc b/mysql-test/include/have_udf.inc index 7be57bbb7a9..d9ca1450043 100644 --- a/mysql-test/include/have_udf.inc +++ b/mysql-test/include/have_udf.inc @@ -1,13 +1,20 @@ # -# Check if server has support for loading udf's -# i.e it will support dlopen +# Check if server has support for loading plugins # ---source include/have_dynamic_loading.inc +if (`SELECT @@have_dynamic_loading != 'YES'`) { + --skip UDF requires dynamic loading +} # # Check if the variable UDF_EXAMPLE_LIB is set # ---require r/have_udf_example.require -disable_query_log; -eval select LENGTH('$UDF_EXAMPLE_LIB') > 0 as 'have_udf_example_lib'; -enable_query_log; +if (`SELECT LENGTH('$UDF_EXAMPLE_LIB') = 0`) { + --skip UDF requires the environment variable \$UDF_EXAMPLE_LIB to be set (normally done by mtr) +} + +# +# Check if --plugin-dir was setup for udf +# +if (`SELECT CONCAT('--plugin-dir=', @@plugin_dir) != '$UDF_EXAMPLE_LIB_OPT'`) { + --skip UDF requires that --plugin-dir is set to the udf plugin dir (either the .opt file does not contain \$UDF_EXAMPLE_LIB_OPT or another plugin is in use) +} diff --git a/mysql-test/include/index_merge1.inc b/mysql-test/include/index_merge1.inc index d137b0957c0..ef116c5addc 100644 --- a/mysql-test/include/index_merge1.inc +++ b/mysql-test/include/index_merge1.inc @@ -303,7 +303,7 @@ drop table t4; create table t4 (a int); insert into t4 values (1),(4),(3); set @save_join_buffer_size=@@join_buffer_size; -set join_buffer_size= 4000; +set join_buffer_size= 4096; explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) from t0 as A force index(i1,i2), t0 as B force index (i1,i2) where (A.key1 < 500000 or A.key2 < 3) diff --git a/mysql-test/include/index_merge2.inc b/mysql-test/include/index_merge2.inc index d65115eac0f..9b98eb3ebf2 100644 --- a/mysql-test/include/index_merge2.inc +++ b/mysql-test/include/index_merge2.inc @@ -122,12 +122,20 @@ insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b) analyze table t1; select count(*) from t1; +if ($index_merge_random_rows_in_EXPLAIN) +{ + --replace_column 9 # +} explain select count(*) from t1 where key1a = 2 and key1b is null and key2a = 2 and key2b is null; select count(*) from t1 where key1a = 2 and key1b is null and key2a = 2 and key2b is null; +if ($index_merge_random_rows_in_EXPLAIN) +{ + --replace_column 9 # +} explain select count(*) from t1 where key1a = 2 and key1b is null and key3a = 2 and key3b is null; diff --git a/mysql-test/include/ipv6.inc b/mysql-test/include/ipv6.inc new file mode 100644 index 00000000000..378733dd03a --- /dev/null +++ b/mysql-test/include/ipv6.inc @@ -0,0 +1,22 @@ +eval CREATE USER testuser@'$IPv6' identified by '1234'; +eval GRANT ALL ON test.* TO testuser@'$IPv6'; +eval SHOW GRANTS FOR testuser@'$IPv6'; +# deliver NULL instead of a valid number, see bug#34037 +eval SET @nip= inet_aton('$IPv6'); +SELECT @nip; +SELECT inet_ntoa(@nip); +# delivers a wrong value, see bug#34037 +SELECT USER(); +SELECT current_user(); +--disable_result_log +SHOW PROCESSLIST; +--enable_result_log +connect (con1, $IPv6, root, , test, $MASTER_MYPORT); +connection default; +disconnect con1; +eval REVOKE ALL ON test.* FROM testuser@'$IPv6'; +eval RENAME USER testuser@'$IPv6' to testuser1@'$IPv6'; +eval SET PASSWORD FOR testuser1@'$IPv6' = PASSWORD ('9876'); +SELECT USER(); +eval DROP USER testuser1@'$IPv6'; + diff --git a/mysql-test/include/ipv6_clients.inc b/mysql-test/include/ipv6_clients.inc new file mode 100644 index 00000000000..3f2b35d811a --- /dev/null +++ b/mysql-test/include/ipv6_clients.inc @@ -0,0 +1,7 @@ +--exec $MYSQLADMIN --no-defaults --default-character-set=latin1 -h $IPv6 -P $MASTER_MYPORT -u root ping +--disable_result_log +--exec $MYSQL_CHECK -h $IPv6 -P $MASTER_MYPORT -u root test +--exec $MYSQL_DUMP -h $IPv6 -P $MASTER_MYPORT -u root test +--exec $MYSQL_SHOW -h $IPv6 -P $MASTER_MYPORT -u root +--exec $MYSQL --host=$IPv6 --port=$MASTER_MYPORT --user=root test -e "SELECT current_user();SELECT user();" +--enable_result_log diff --git a/mysql-test/include/master-slave-reset.inc b/mysql-test/include/master-slave-reset.inc index 938eb2c074a..f54f5b83eb5 100644 --- a/mysql-test/include/master-slave-reset.inc +++ b/mysql-test/include/master-slave-reset.inc @@ -6,12 +6,29 @@ # Since we expect STOP SLAVE to produce a warning as the slave is # stopped (the server was started with skip-slave-start), we disable # warnings when doing STOP SLAVE. +# +# $no_change_master If true, no change master will be done nor any reset slave. +# This is to avoid touching the relay-log.info file allowing +# the test to create one itself. +# $skip_slave_start If true, the slave will not be started connection slave; + +#we expect STOP SLAVE to produce a warning as the slave is stopped +#(the server was started with skip-slave-start) --disable_warnings stop slave; +--disable_query_log +if (!$no_change_master) { + eval CHANGE MASTER TO MASTER_USER='root', + MASTER_CONNECT_RETRY=1, + MASTER_HOST='127.0.0.1', + MASTER_PORT=$MASTER_MYPORT; +} +--enable_query_log source include/wait_for_slave_to_stop.inc; --enable_warnings + connection master; --disable_warnings --disable_query_log @@ -20,17 +37,39 @@ use test; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; --enable_warnings reset master; + --disable_query_log -reset slave; +if (!$no_change_master) { + reset slave; +} --enable_query_log connection slave; -reset slave; + +--disable_warnings +# the first RESET SLAVE may produce a warning about non-existent +# 'ndb_apply_status' table, because this table is created +# asynchronously at the server startup and may not exist yet +# if RESET SLAVE comes too soon after the server startup +if (!$no_change_master) { + reset slave; +} +--enable_warnings + # Clean up old test tables --disable_warnings drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; --enable_warnings + --disable_query_log +#eval CHANGE MASTER TO MASTER_USER='root', +# MASTER_CONNECT_RETRY=1, +# MASTER_HOST='127.0.0.1', +# MASTER_PORT=$MASTER_MYPORT; reset master; --enable_query_log -start slave; -source include/wait_for_slave_to_start.inc; + +if (!$skip_slave_start) { + start slave; + source include/wait_for_slave_to_start.inc; +} + diff --git a/mysql-test/include/master-slave.inc b/mysql-test/include/master-slave.inc index e0eb87f02f7..134bb61ddab 100644 --- a/mysql-test/include/master-slave.inc +++ b/mysql-test/include/master-slave.inc @@ -1,4 +1,6 @@ # Replication tests need binlog +# +# $skip_slave_start If true, the slave will not be started source include/have_log_bin.inc; connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); @@ -8,5 +10,10 @@ connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT,); -- source include/master-slave-reset.inc +if (!$skip_slave_start) { + connection master; + sync_slave_with_master; +} + # Set the default connection to 'master' connection master; diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql index b2cc86fbd46..00e8c4e6c95 100644 --- a/mysql-test/include/mtr_warnings.sql +++ b/mysql-test/include/mtr_warnings.sql @@ -175,6 +175,16 @@ INSERT INTO global_suppressions VALUES ("Can't find file: '.\\\\test\\\\\\?{8}.frm'"), ("Slave: Unknown table 't1' Error_code: 1051"), + /* Added 2009-08-XX after fixing Bug #42408 */ + + ("Although a path was specified for the .* option, log tables are used"), + ("Backup: Operation aborted"), + ("Restore: Operation aborted"), + ("Restore: The grant .* was skipped because the user does not exist"), + ("The path specified for the variable .* is not a directory or cannot be written:"), + ("Master server does not support or not configured semi-sync replication, fallback to asynchronous"), + (": The MySQL server is running with the --secure-backup-file-priv option so it cannot execute this statement"), + ("Slave: Unknown table 't1' Error_code: 1051"), /* Transient network failures that cause warnings on reconnect. BUG#47743 and BUG#47983. diff --git a/mysql-test/include/mysqld--help.inc b/mysql-test/include/mysqld--help.inc new file mode 100644 index 00000000000..3c8d19107c9 --- /dev/null +++ b/mysql-test/include/mysqld--help.inc @@ -0,0 +1,41 @@ +# +# mysqld --help +# +--source include/not_embedded.inc + +# +# force lower-case-table-names=1 (linux/macosx have different defaults) +# force symbolic-links=0 (valgrind build has a different default) +# +exec $MYSQLD_BOOTSTRAP_CMD --symbolic-links=0 --lower-case-table-names=1 --help --verbose > $MYSQL_TMP_DIR/mysqld--help.txt 2>&1; + +perl; + @skipvars=qw/basedir open-files-limit general-log-file log + log-slow-queries pid-file slow-query-log-file + datadir slave-load-tmpdir tmpdir/; + @plugins=qw/innodb ndb ndbcluster safemalloc debug temp-pool ssl des-key-file + thread-concurrency super-large-pages mutex-deadlock-detector/; + @env=qw/MYSQLTEST_VARDIR MYSQL_TEST_DIR MYSQL_LIBDIR MYSQL_SHAREDIR/; + $re1=join('|', @skipvars, @plugins); + $re2=join('|', @plugins); + $skip=0; + open(F, '<', "$ENV{MYSQL_TMP_DIR}/mysqld--help.txt") or die; + while (<F>) { + next if 1../The following groups are read/; + next if /^($re1) /; + next if /^($re2)-/; + $skip=0 if /^ -/; + $skip=1 if / --($re2)\b/; + # fixes for 32-bit + y!\\!/!; + s/\b4294967295\b/18446744073709551615/; + s/\b2146435072\b/9223372036853727232/; + s/\b196608\b/262144/; + foreach $var (@env) { s/$ENV{$var}/$var/ } + next if /use --skip-(use-)?symbolic-links to disable/; # for valgrind, again + next if $skip; + print; + } + close F; +EOF + diff --git a/mysql-test/include/not_ndb_default.inc b/mysql-test/include/not_ndb_default.inc index ca3c57a671a..682a2944171 100644 --- a/mysql-test/include/not_ndb_default.inc +++ b/mysql-test/include/not_ndb_default.inc @@ -1,4 +1,4 @@ --require r/not_ndb_default.require disable_query_log; -select convert(@@table_type using latin1) NOT IN ("ndbcluster","NDBCLUSTER") as "TRUE"; +select convert(@@storage_engine using latin1) NOT IN ("ndbcluster","NDBCLUSTER") as "TRUE"; enable_query_log; diff --git a/mysql-test/include/query_cache.inc b/mysql-test/include/query_cache.inc index 7ce97b42158..0cc1ebb21d6 100644 --- a/mysql-test/include/query_cache.inc +++ b/mysql-test/include/query_cache.inc @@ -114,7 +114,7 @@ connection default; # This should be 'YES'. SHOW VARIABLES LIKE 'have_query_cache'; -SET GLOBAL query_cache_size = 200000; +SET GLOBAL query_cache_size = 204800; flush status; SET @@autocommit=1; eval SET SESSION STORAGE_ENGINE = $engine_type; diff --git a/mysql-test/include/query_cache_sql_prepare.inc b/mysql-test/include/query_cache_sql_prepare.inc index 1842d5412bb..769cd535f37 100644 --- a/mysql-test/include/query_cache_sql_prepare.inc +++ b/mysql-test/include/query_cache_sql_prepare.inc @@ -1,11 +1,13 @@ ############### include/query_cache_sql_prepare.inc ################ # # This is to see how statements prepared via the PREPARE SQL command -# go into the query cache: if using parameters they cannot; if not -# using parameters they can. +# go into the query cache. # Query cache is abbreviated as "QC" # # Last update: +# 2008-05-26 Kostja +# - Add test coverage for automatic statement reprepare +# # 2007-05-03 ML - Move t/query_cache_sql_prepare.test # to include/query_cache_sql_prepare.inc # - Create two toplevel tests sourcing this routine @@ -25,7 +27,7 @@ connect (con1,localhost,root,,test,$MASTER_MYPORT,); connection default; set @initial_query_cache_size = @@global.query_cache_size; -set @@global.query_cache_size=100000; +set @@global.query_cache_size=102400; flush status; --disable_warnings drop table if exists t1; @@ -176,7 +178,7 @@ show status like 'Qcache_hits'; # then QC is re-enabled for more EXECUTE. --echo ---- switch to connection default ---- connection default; -set global query_cache_size=100000; +set global query_cache_size=102400; # Expect to see additional Qcache_hits. # The fact that the QC was temporary disabled should have no affect # except that the first execute will not hit results from the @@ -233,7 +235,7 @@ prepare stmt3 from "select * from t1 where c1=10"; --echo ---- switch to connection default ---- connection default; # then QC is enabled at EXECUTE -set global query_cache_size=100000; +set global query_cache_size=102400; show status like 'Qcache_hits'; execute stmt1; show status like 'Qcache_hits'; @@ -258,7 +260,7 @@ connection default; set global query_cache_size=0; prepare stmt1 from "select * from t1 where c1=?"; # then QC is enabled at EXECUTE -set global query_cache_size=100000; +set global query_cache_size=102400; show status like 'Qcache_hits'; set @a=1; execute stmt1 using @a; @@ -490,6 +492,37 @@ use test; --echo --echo ######################################################################## +--echo # +--echo # Bug#27430 Crash in subquery code when in PS and table DDL changed +--echo # after PREPARE +--echo # Check the effect of automatic reprepare on query cache +--echo # +--echo ######################################################################## +--disable_warnings +drop table if exists t1; +--enable_warnings +create table t1 (a varchar(255)); +insert into t1 (a) values ("Pack my box with five dozen liquor jugs."); +flush status; +prepare stmt from "select a from t1"; +execute stmt; +set @@global.query_cache_size=0; +alter table t1 add column b int; +execute stmt; +set @@global.query_cache_size=102400; +execute stmt; +execute stmt; +--echo # +--echo # Sic: ALTER TABLE caused an automatic reprepare +--echo # of the prepared statement. Since the query cache was disabled +--echo # at the time of reprepare, the new prepared statement doesn't +--echo # work with it. +--echo # +show status like 'Qcache_hits'; +show status like 'Qcache_queries_in_cache'; +--echo # Cleanup +deallocate prepare stmt; +drop table t1; ############################################################################### diff --git a/mysql-test/include/rpl_ip_mix.inc b/mysql-test/include/rpl_ip_mix.inc new file mode 100644 index 00000000000..96766e7dbdd --- /dev/null +++ b/mysql-test/include/rpl_ip_mix.inc @@ -0,0 +1,24 @@ +--echo connect (master,$IPv6,root,,test,MASTER_MYPORT); +connect (master,$IPv6,root,,test,$MASTER_MYPORT); +--echo connect (slave,127.0.0.1,root,,test,SLAVE_MYPORT); +connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT); +--echo connection master; +connection master; +reset master; +source include/show_master_status.inc; +save_master_pos; +--echo connection slave; +connection slave; +reset slave; +let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); +--echo Master-Host: $master_host +eval change master to master_host='$IPv6'; +let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); +--echo Master-Host: $master_host +--echo disconnect slave; +disconnect slave; +--echo disconnect master; +disconnect master; +--echo connection default; +connection default; + diff --git a/mysql-test/include/rpl_ip_mix2.inc b/mysql-test/include/rpl_ip_mix2.inc new file mode 100644 index 00000000000..390c788a461 --- /dev/null +++ b/mysql-test/include/rpl_ip_mix2.inc @@ -0,0 +1,24 @@ +--echo connect (master,127.0.0.1,root,,test,MASTER_MYPORT); +connect (master,127.0.0.1,root,,test,$MASTER_MYPORT); +--echo connect (slave,$IPv6,root,,test,SLAVE_MYPORT); +connect (slave,$IPv6,root,,test,$SLAVE_MYPORT); +--echo connection master; +connection master; +reset master; +source include/show_master_status.inc; +save_master_pos; +--echo connection slave; +connection slave; +reset slave; +let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); +--echo Master-Host: $master_host +eval change master to master_host='$IPv6'; +let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); +--echo Master-Host: $master_host +--echo disconnect slave; +disconnect slave; +--echo disconnect master; +disconnect master; +--echo connection default; +connection default; + diff --git a/mysql-test/include/rpl_ipv6.inc b/mysql-test/include/rpl_ipv6.inc new file mode 100644 index 00000000000..d2d53a4841a --- /dev/null +++ b/mysql-test/include/rpl_ipv6.inc @@ -0,0 +1,22 @@ +--echo connect (master,$IPv6,root,,test,MASTER_MYPORT); +connect (master,$IPv6,root,,test,$MASTER_MYPORT); +--echo connect (slave,$IPv6,root,,test,SLAVE_MYPORT); +connect (slave,$IPv6,root,,test,$SLAVE_MYPORT); +--echo connection master; +connection master; +reset master; +source include/show_master_status.inc; +save_master_pos; +--echo connection slave; +connection slave; +reset slave; +eval change master to master_host='$IPv6'; +let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); +--echo Master-Host: $master_host +--echo disconnect slave; +disconnect slave; +--echo disconnect master; +disconnect master; +--echo connection default; +connection default; + diff --git a/mysql-test/include/rpl_udf.inc b/mysql-test/include/rpl_udf.inc index 30f39d79d49..8be866613cb 100644 --- a/mysql-test/include/rpl_udf.inc +++ b/mysql-test/include/rpl_udf.inc @@ -55,11 +55,13 @@ connection master; --echo "Running on the master" --enable_info eval CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=$engine_type; +--disable_warnings INSERT INTO t1 VALUES(myfunc_int(100), myfunc_double(50.00)); INSERT INTO t1 VALUES(myfunc_int(10), myfunc_double(5.00)); INSERT INTO t1 VALUES(myfunc_int(200), myfunc_double(25.00)); INSERT INTO t1 VALUES(myfunc_int(1), myfunc_double(500.00)); SELECT * FROM t1 ORDER BY sum; +--enable_warnings --disable_info sync_slave_with_master; diff --git a/mysql-test/include/setup_fake_relay_log.inc b/mysql-test/include/setup_fake_relay_log.inc index f88806e1079..b11e6afbeca 100644 --- a/mysql-test/include/setup_fake_relay_log.inc +++ b/mysql-test/include/setup_fake_relay_log.inc @@ -69,7 +69,21 @@ let $_fake_relay_log_purge= `SELECT @@global.relay_log_purge`; # Create relay log file. copy_file $fake_relay_log $_fake_relay_log; # Create relay log index. ---exec echo $_fake_filename-fake.000001 > $_fake_relay_index + +# After patch for BUG#12190, the filename used in CHANGE MASTER +# RELAY_LOG_FILE will be automatically added the directory of the +# relay log before comparison, thus we need to added the directory +# part (./ on unix .\ on windows) when faking the relay-log-bin.index. + +if (`select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") = 0`) +{ + eval select './$_fake_filename-fake.000001\n' into dumpfile '$_fake_relay_index'; +} + +if (`select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") != 0`) +{ + eval select '.\\\\$_fake_filename-fake.000001\n' into dumpfile '$_fake_relay_index'; +} # Setup replication from existing relay log. eval CHANGE MASTER TO MASTER_HOST='dummy.localdomain', RELAY_LOG_FILE='$_fake_filename-fake.000001', RELAY_LOG_POS=4; diff --git a/mysql-test/include/show_binlog_events.inc b/mysql-test/include/show_binlog_events.inc index 68f913a16a3..fcdc52eaf14 100644 --- a/mysql-test/include/show_binlog_events.inc +++ b/mysql-test/include/show_binlog_events.inc @@ -1,10 +1,35 @@ # $binlog_start can be set by caller or take a default value +# $binary_log_file the name of the log file show +# $binary_log_limit_row - sets the number of binlog rows to be returned +# $binary_log_limit_offset - sets the offset where to start returning events + +let $show_binlog_events= show binlog events; if (!$binlog_start) { - let $binlog_start=106; + # defaults to chop the first event in the binary log + let $binlog_start=107; } + +if (!`SELECT '$binary_log_file' = ''`) +{ + let $show_binlog_events= $show_binlog_events in '$binary_log_file'; +} +let $show_binlog_events= $show_binlog_events from $binlog_start; + +if ($binary_log_limit_row) +{ + let $limit= limit; + if ($binary_log_limit_offset) + { + let $limit= $limit $binary_log_limit_offset, ; + } + + let $limit= $limit $binary_log_limit_row; + let $show_binlog_events= $show_binlog_events $limit; +} + --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start <binlog_start> --replace_column 2 # 4 # 5 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ ---eval show binlog events from $binlog_start +--eval $show_binlog_events diff --git a/mysql-test/include/show_binlog_events2.inc b/mysql-test/include/show_binlog_events2.inc index 5dd272c562d..0e1a889bacc 100644 --- a/mysql-test/include/show_binlog_events2.inc +++ b/mysql-test/include/show_binlog_events2.inc @@ -1,4 +1,4 @@ ---let $binlog_start=106 +--let $binlog_start=107 --replace_result $binlog_start <binlog_start> --replace_column 2 # 5 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ diff --git a/mysql-test/include/show_relaylog_events.inc b/mysql-test/include/show_relaylog_events.inc new file mode 100644 index 00000000000..6f63b055d58 --- /dev/null +++ b/mysql-test/include/show_relaylog_events.inc @@ -0,0 +1,35 @@ +# $binlog_start can be set by caller or take a default value +# $binary_log_file the name of the log file show +# $binary_log_limit_row - sets the number of binlog rows to be returned +# $binary_log_limit_offset - sets the offset where to start returning events + +let $show_binlog_events= show relaylog events; + +if (!$binlog_start) +{ + # defaults to chop the first event in the binary log + let $binlog_start=106; +} + +if (!`SELECT '$binary_log_file' = ''`) +{ + let $show_binlog_events= $show_binlog_events in '$binary_log_file'; +} +let $show_binlog_events= $show_binlog_events from $binlog_start; + +if ($binary_log_limit_row) +{ + let $limit= limit; + if ($binary_log_limit_offset) + { + let $limit= $limit $binary_log_limit_offset, ; + } + + let $limit= $limit $binary_log_limit_row; + let $show_binlog_events= $show_binlog_events $limit; +} + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start <binlog_start> +--replace_column 2 # 4 # 5 # +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ /Server ver:.*$/SERVER_VERSION, BINLOG_VERSION/ +--eval $show_binlog_events diff --git a/mysql-test/include/show_slave_status2.inc b/mysql-test/include/show_slave_status2.inc index 9c4e14c62c2..7e970b31d8e 100644 --- a/mysql-test/include/show_slave_status2.inc +++ b/mysql-test/include/show_slave_status2.inc @@ -3,6 +3,6 @@ # masked out log positions ---replace_result $MASTER_MYPORT MASTER_PORT +--replace_result $MASTER_MYPORT MASTER_PORT $DEFAULT_MASTER_PORT 3306 --replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # query_vertical SHOW SLAVE STATUS; diff --git a/mysql-test/include/test_fieldsize.inc b/mysql-test/include/test_fieldsize.inc index cbe63e26318..606bc63779d 100644 --- a/mysql-test/include/test_fieldsize.inc +++ b/mysql-test/include/test_fieldsize.inc @@ -22,7 +22,7 @@ eval $test_insert; connection slave; START SLAVE; -wait_for_slave_to_stop; +--source include/wait_for_slave_sql_to_stop.inc --replace_result $MASTER_MYPORT MASTER_PORT --replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # --query_vertical SHOW SLAVE STATUS diff --git a/mysql-test/include/wait_for_ndb_to_binlog.inc b/mysql-test/include/wait_for_ndb_to_binlog.inc new file mode 100644 index 00000000000..77da6d62154 --- /dev/null +++ b/mysql-test/include/wait_for_ndb_to_binlog.inc @@ -0,0 +1,41 @@ +# ==== Purpose ==== +# +# Several test primitives from mysql-test/extra/rpl_tests +# shared for test cases for MyISAM, InnoDB, NDB and other +# engines. But for NDB all events will be added by NDB +# injector and now there are no way to detect the state of +# NDB injector therefore this primitive waits 5 sec +# if engine type is NDB. +# In future that should be fixed by waiting of proper +# state of NDB injector. +# +# ==== Usage ==== +# +# let $engine_type= NDB; +# --source include/wait_for_ndb_to_binlog.inc +# +# ==== Parameters ===== +# +# $engine_type +# Type of engine. If type is NDB then it waits $wait_time sec +# +# $wait_time +# Test will wait $wait_time seconds + +let $_wait_time= 5; + +if (!$wait_time) { + let $_wait_time= $wait_time; +} + +if (`SELECT UPPER(LEFT('$engine_type',3)) = 'NDB'`) { + while (!$_wait_time) { + let $_wait_time_internal= 10; + while (!$_wait_time_internal) { + sleep 0.1; + dec $_wait_time_internal; + } + dec $_wait_time; + } +} + diff --git a/mysql-test/include/wait_for_slave_param.inc b/mysql-test/include/wait_for_slave_param.inc index 82e57922913..1e690bdfe9c 100644 --- a/mysql-test/include/wait_for_slave_param.inc +++ b/mysql-test/include/wait_for_slave_param.inc @@ -49,6 +49,8 @@ if (!$_slave_timeout_counter) { let $_slave_timeout_counter= 3000; } +# Save resulting counter for later use. +let $slave_tcnt= $_slave_timeout_counter; let $_slave_param_comparison= $slave_param_comparison; if (`SELECT '$_slave_param_comparison' = ''`) @@ -70,7 +72,7 @@ while (`SELECT NOT('$_show_slave_status_value' $_slave_param_comparison '$slave_ # This has to be outside the loop until BUG#41913 has been fixed if (!$_slave_timeout_counter) { - --echo **** ERROR: timeout after $slave_timeout seconds while waiting for slave parameter $slave_param $_slave_param_comparison $slave_param_value **** + --echo **** ERROR: timeout after $slave_tcnt deci-seconds while waiting for slave parameter $slave_param $_slave_param_comparison $slave_param_value **** if (`SELECT '$slave_error_message' != ''`) { --echo Message: $slave_error_message diff --git a/mysql-test/include/wait_show_condition.inc b/mysql-test/include/wait_show_condition.inc index 253101d1e07..f683ca7b47b 100644 --- a/mysql-test/include/wait_show_condition.inc +++ b/mysql-test/include/wait_show_condition.inc @@ -2,13 +2,16 @@ # # SUMMARY # -# Waits until the show statement ($show_statement) has at least within one of -# the rows of the result set for the field ($field) a value which fulfils +# Waits until the show statement ($show_statement) has one or all of the +# rows of the result set for the field ($field) a value which fulfils # a condition ($condition), or the operation times out. # # # USAGE # +# All rows of the result must fulfil the condition if $all_rows_fulfil is 1 +# else at least one of the result must fulfil the condition. +# let $wait_for_all= 1; # let $show_statement= SHOW PROCESSLIST; # let $field= State; # let $condition= = 'Updating'; @@ -46,27 +49,56 @@ inc $max_run_time; let $found= 0; let $max_end_time= `SELECT UNIX_TIMESTAMP() + $max_run_time`; -while (`SELECT UNIX_TIMESTAMP() <= $max_end_time AND $found = 0`) + +if (`SELECT '$wait_for_all' != '1'`) { - # Sleep a bit to avoid too heavy load. - real_sleep 0.2; - let $rowno= 1; - let $process_result= 1; - while (`SELECT $process_result = 1 AND $found = 0`) - { - let $field_value= query_get_value($show_statement, $field, $rowno); - if (`SELECT '$field_value' $condition`) - { - let $found= 1; - } - if (`SELECT '$field_value' = 'No such row'`) - { - # We are behind the last row of the result set. - let $process_result= 0; - } - inc $rowno; - } + while (`SELECT UNIX_TIMESTAMP() <= $max_end_time AND $found = 0`) + { + # Sleep a bit to avoid too heavy load. + real_sleep 0.2; + let $rowno= 1; + let $process_result= 1; + while (`SELECT $process_result = 1 AND $found = 0`) + { + let $field_value= query_get_value($show_statement, $field, $rowno); + if (`SELECT '$field_value' $condition`) + { + let $found= 1; + } + if (`SELECT '$field_value' = 'No such row'`) + { + # We are behind the last row of the result set. + let $process_result= 0; + } + inc $rowno; + } + } } + +if (`SELECT '$wait_for_all' = '1'`) +{ + while (`SELECT UNIX_TIMESTAMP() <= $max_end_time AND $found = 0`) + { + # Sleep a bit to avoid too heavy load. + real_sleep 0.2; + let $rowno= 1; + let $process_result= 1; + while (`SELECT $process_result = 1 AND $found = 0`) + { + let $field_value= query_get_value($show_statement, $field, $rowno); + if (`SELECT '$field_value' = 'No such row'`) + { + let $found= 1; + } + if (`SELECT $found = 0 AND NOT '$field_value' $condition`) + { + let process_result= 0; + } + inc $rowno; + } + } +} + if (!$found) { echo # Timeout in include/wait_show_condition.inc for $wait_condition; diff --git a/mysql-test/include/wait_until_disconnected.inc b/mysql-test/include/wait_until_disconnected.inc index a4362e52d01..8a989becc18 100644 --- a/mysql-test/include/wait_until_disconnected.inc +++ b/mysql-test/include/wait_until_disconnected.inc @@ -7,7 +7,7 @@ let $counter= 500; let $mysql_errno= 0; while (!$mysql_errno) { - --error 0,1053,2002,2006,2013 + --error 0,1040,1053,2002,2003,2006,2013 show status; dec $counter; |