diff options
Diffstat (limited to 'mysql-test/include')
27 files changed, 101 insertions, 184 deletions
diff --git a/mysql-test/include/check_concurrent_insert.inc b/mysql-test/include/check_concurrent_insert.inc index f4bec3c9cdb..62de485d8f1 100644 --- a/mysql-test/include/check_concurrent_insert.inc +++ b/mysql-test/include/check_concurrent_insert.inc @@ -23,7 +23,7 @@ # Reset DEBUG_SYNC facility for safety. set debug_sync= "RESET"; -if (`SELECT '$restore_table' <> ''`) +if ($restore_table) { --eval create temporary table t_backup select * from $restore_table; } @@ -82,7 +82,7 @@ connection default; --eval delete from $table where i = 0; -if (`SELECT '$restore_table' <> ''`) +if ($restore_table) { --eval truncate table $restore_table; --eval insert into $restore_table select * from t_backup; diff --git a/mysql-test/include/check_no_concurrent_insert.inc b/mysql-test/include/check_no_concurrent_insert.inc index f60401bcad1..6938c53fd16 100644 --- a/mysql-test/include/check_no_concurrent_insert.inc +++ b/mysql-test/include/check_no_concurrent_insert.inc @@ -23,7 +23,7 @@ # Reset DEBUG_SYNC facility for safety. set debug_sync= "RESET"; -if (`SELECT '$restore_table' <> ''`) +if ($restore_table) { --eval create temporary table t_backup select * from $restore_table; } @@ -67,7 +67,7 @@ if (!$success) --eval delete from $table where i = 0; -if (`SELECT '$restore_table' <> ''`) +if ($restore_table) { --eval truncate table $restore_table; --eval insert into $restore_table select * from t_backup; diff --git a/mysql-test/include/get_relay_log_pos.inc b/mysql-test/include/get_relay_log_pos.inc index 7ce36fd3c50..61ee07fc655 100644 --- a/mysql-test/include/get_relay_log_pos.inc +++ b/mysql-test/include/get_relay_log_pos.inc @@ -10,12 +10,12 @@ # # at this point, get_relay_log_pos.inc sets $relay_log_pos. echo position # # in $relay_log_file: $relay_log_pos. -if (`SELECT '$relay_log_file' = ''`) +if (!$relay_log_file) { --die 'variable $relay_log_file is null' } -if (`SELECT '$master_log_pos' = ''`) +if (!$master_log_pos) { --die 'variable $master_log_pos is null' } diff --git a/mysql-test/include/have_not_innodb_plugin.inc b/mysql-test/include/have_not_innodb_plugin.inc index aaefbaf661c..e40fd811021 100644 --- a/mysql-test/include/have_not_innodb_plugin.inc +++ b/mysql-test/include/have_not_innodb_plugin.inc @@ -1,4 +1,4 @@ disable_query_log; --require r/not_true.require -select (PLUGIN_LIBRARY LIKE 'ha_innodb_plugin%') as `TRUE` from information_schema.plugins where PLUGIN_NAME='InnoDB'; +select (PLUGIN_LIBRARY LIKE 'ha_innodb_plugin%' OR PLUGIN_DESCRIPTION LIKE '%xtradb%') as `TRUE` from information_schema.plugins where PLUGIN_NAME='InnoDB'; enable_query_log; diff --git a/mysql-test/include/index_merge2.inc b/mysql-test/include/index_merge2.inc index 32a176630ad..566e151dc7f 100644 --- a/mysql-test/include/index_merge2.inc +++ b/mysql-test/include/index_merge2.inc @@ -345,3 +345,55 @@ explain select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 4 select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40); drop table t1; +--echo # +--echo # Bug#56423: Different count with SELECT and CREATE SELECT queries +--echo # + +CREATE TABLE t1 ( + a INT, + b INT, + c INT, + d INT, + PRIMARY KEY (a), + KEY (c), + KEY bd (b,d) +); + +INSERT INTO t1 VALUES +(1, 0, 1, 0), +(2, 1, 1, 1), +(3, 1, 1, 1), +(4, 0, 1, 1); + +EXPLAIN +SELECT a +FROM t1 +WHERE c = 1 AND b = 1 AND d = 1; + +CREATE TABLE t2 ( a INT ) +SELECT a +FROM t1 +WHERE c = 1 AND b = 1 AND d = 1; + +SELECT * FROM t2; + +DROP TABLE t1, t2; + +CREATE TABLE t1( a INT, b INT, KEY(a), KEY(b) ); +INSERT INTO t1 VALUES (1, 2), (1, 2), (1, 2), (1, 2); +SELECT * FROM t1 FORCE INDEX(a, b) WHERE a = 1 AND b = 2; + +DROP TABLE t1; + +--echo # Code coverage of fix. +CREATE TABLE t1 ( a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT); +INSERT INTO t1 (b) VALUES (1); +UPDATE t1 SET b = 2 WHERE a = 1; +SELECT * FROM t1; + +CREATE TABLE t2 ( a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(1) ); +INSERT INTO t2 (b) VALUES ('a'); +UPDATE t2 SET b = 'b' WHERE a = 1; +SELECT * FROM t2; + +DROP TABLE t1, t2; diff --git a/mysql-test/include/index_merge_ror_cpk.inc b/mysql-test/include/index_merge_ror_cpk.inc index cfc2ed3885e..3912aa34026 100644 --- a/mysql-test/include/index_merge_ror_cpk.inc +++ b/mysql-test/include/index_merge_ror_cpk.inc @@ -126,3 +126,19 @@ WHERE drop table t1; +--echo # +--echo # Bug#50402 Optimizer producing wrong results when using Index Merge on InnoDB +--echo # +CREATE TABLE t1 (f1 INT, PRIMARY KEY (f1)); +INSERT INTO t1 VALUES (2); +CREATE TABLE t2 (f1 INT, f2 INT, f3 char(1), + PRIMARY KEY (f1), KEY (f2), KEY (f3) ); +INSERT INTO t2 VALUES (1, 1, 'h'), (2, 3, 'h'), (3, 2, ''), (4, 2, ''); + +SELECT t1.f1 FROM t1 +WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2; + +EXPLAIN SELECT t1.f1 FROM t1 +WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2; + +DROP TABLE t1,t2; diff --git a/mysql-test/include/kill_query.inc b/mysql-test/include/kill_query.inc index b303ed0ec39..1c949d3cbad 100644 --- a/mysql-test/include/kill_query.inc +++ b/mysql-test/include/kill_query.inc @@ -44,7 +44,7 @@ connection master; # kill the query that is waiting eval kill query $connection_id; -if (`SELECT '$debug_lock' != ''`) +if ($debug_lock) { # release the lock to allow binlog continue eval SELECT RELEASE_LOCK($debug_lock); @@ -57,7 +57,7 @@ reap; connection master; -if (`SELECT '$debug_lock' != ''`) +if ($debug_lock) { # get lock again to make the next query wait eval SELECT GET_LOCK($debug_lock, 10); diff --git a/mysql-test/include/kill_query_and_diff_master_slave.inc b/mysql-test/include/kill_query_and_diff_master_slave.inc index 611d6929c99..b3846d12df1 100644 --- a/mysql-test/include/kill_query_and_diff_master_slave.inc +++ b/mysql-test/include/kill_query_and_diff_master_slave.inc @@ -25,7 +25,7 @@ source include/kill_query.inc; connection master; disable_query_log; disable_result_log; -if (`SELECT '$debug_lock' != ''`) +if ($debug_lock) { eval SELECT RELEASE_LOCK($debug_lock); } @@ -36,8 +36,8 @@ source include/diff_master_slave.inc; # Acquire the debug lock again if used connection master; -disable_query_log; disable_result_log; if (`SELECT '$debug_lock' != -''`) { eval SELECT GET_LOCK($debug_lock, 10); } enable_result_log; -enable_query_log; +disable_query_log; disable_result_log; +if ($debug_lock) { eval SELECT GET_LOCK($debug_lock, 10); } +enable_result_log; enable_query_log; connection $connection_name; diff --git a/mysql-test/include/mix2.inc b/mysql-test/include/mix2.inc index 24e958e810f..ba11937dfb9 100644 --- a/mysql-test/include/mix2.inc +++ b/mysql-test/include/mix2.inc @@ -1910,7 +1910,7 @@ select hex(s1) from t4; drop table t1,t2,t3,t4; } -if (test_foreign_keys) +if ($test_foreign_keys) { eval create table t1 (a int primary key,s1 varbinary(3) not null unique) engine=$engine_type; eval create table t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=$engine_type; @@ -2405,7 +2405,7 @@ drop table t1, t2, t3, t5, t6, t8, t9; } # End transactional tests -if (test_foreign_keys) +if ($test_foreign_keys) { # bug 18934, "InnoDB crashes when table uses column names like DB_ROW_ID" --error 1005 diff --git a/mysql-test/include/not_blackhole.inc b/mysql-test/include/not_blackhole.inc new file mode 100644 index 00000000000..078927ec4ca --- /dev/null +++ b/mysql-test/include/not_blackhole.inc @@ -0,0 +1,5 @@ +if (`SELECT count(*) FROM information_schema.engines WHERE + (support = 'YES' OR support = 'DEFAULT') AND + engine = 'blackhole'`){ + skip Blackhole engine enabled; +} diff --git a/mysql-test/include/percona_query_cache_with_comments.inc b/mysql-test/include/percona_query_cache_with_comments.inc deleted file mode 100644 index bed87bd4c22..00000000000 --- a/mysql-test/include/percona_query_cache_with_comments.inc +++ /dev/null @@ -1,95 +0,0 @@ ---source include/percona_query_cache_with_comments_clear.inc -let $query=/* with comment first */select * from t1; -eval $query; ---source include/percona_query_cache_with_comments_eval.inc - -let $query=# with comment first -select * from t1; ---source include/percona_query_cache_with_comments_eval.inc - -let $query=-- with comment first -select * from t1; ---source include/percona_query_cache_with_comments_eval.inc - -let $query=/* with comment first and "quote" */select * from t1; ---source include/percona_query_cache_with_comments_eval.inc - -let $query=# with comment first and "quote" -select * from t1; ---source include/percona_query_cache_with_comments_eval.inc - -let $query=-- with comment first and "quote" -select * from t1; ---source include/percona_query_cache_with_comments_eval.inc - -let $query= - /* with comment and whitespaces first */select * from t1; ---source include/percona_query_cache_with_comments_eval.inc - -let $query= - # with comment and whitespaces first -select * from t1; ---source include/percona_query_cache_with_comments_eval.inc - -let $query= - -- with comment and whitespaces first -select * from t1; ---source include/percona_query_cache_with_comments_eval.inc - -let $internal=* internal comment *; - -let $query=select * /$internal/ from t1; ---source include/percona_query_cache_with_comments_eval.inc -let $query=select */$internal/ from t1; ---source include/percona_query_cache_with_comments_eval.inc -let $query=select */$internal/from t1; ---source include/percona_query_cache_with_comments_eval.inc - -let $internal=* internal comment with "quote" *; - -let $query=select * /$internal/ from t1; ---source include/percona_query_cache_with_comments_eval.inc -let $query=select */$internal/ from t1; ---source include/percona_query_cache_with_comments_eval.inc -let $query=select */$internal/from t1; ---source include/percona_query_cache_with_comments_eval.inc - -let $query=select * from t1 -; ---source include/percona_query_cache_with_comments_eval.inc - -let $query=select * from t1 ; ---source include/percona_query_cache_with_comments_eval.inc - -let $query=select * from t1 ; ---source include/percona_query_cache_with_comments_eval.inc - -let $query=select * from t1 -/* comment in the end */; ---source include/percona_query_cache_with_comments_eval.inc - -let $query=select * from t1 -/* *\/ */; ---source include/percona_query_cache_with_comments_eval.inc - -let $query=select * from t1 -/* comment in the end */ -; ---source include/percona_query_cache_with_comments_eval.inc - -let $query=select * from t1 #comment in the end; ---source include/percona_query_cache_with_comments_eval.inc - -let $query=select * from t1 #comment in the end -; ---source include/percona_query_cache_with_comments_eval.inc - -let $query=select * from t1 -- comment in the end; ---source include/percona_query_cache_with_comments_eval.inc - -let $query=select * from t1 -- comment in the end -; ---source include/percona_query_cache_with_comments_eval.inc - -let $query=select ' \' ' from t1; ---source include/percona_query_cache_with_comments_eval.inc diff --git a/mysql-test/include/percona_query_cache_with_comments_begin.inc b/mysql-test/include/percona_query_cache_with_comments_begin.inc deleted file mode 100644 index 38bfce20263..00000000000 --- a/mysql-test/include/percona_query_cache_with_comments_begin.inc +++ /dev/null @@ -1,12 +0,0 @@ --- source include/have_query_cache.inc - -set GLOBAL query_cache_size=1355776; - ---disable_warnings -drop table if exists t1; ---enable_warnings - -create table t1 (a int not null); -insert into t1 values (1),(2),(3); - ---source include/percona_query_cache_with_comments_clear.inc diff --git a/mysql-test/include/percona_query_cache_with_comments_clear.inc b/mysql-test/include/percona_query_cache_with_comments_clear.inc deleted file mode 100644 index 728a19a3c97..00000000000 --- a/mysql-test/include/percona_query_cache_with_comments_clear.inc +++ /dev/null @@ -1,5 +0,0 @@ -# Reset query cache variables. -flush query cache; # This crashed in some versions -flush query cache; # This crashed in some versions -reset query cache; -flush status; diff --git a/mysql-test/include/percona_query_cache_with_comments_end.inc b/mysql-test/include/percona_query_cache_with_comments_end.inc deleted file mode 100644 index d5356359d7e..00000000000 --- a/mysql-test/include/percona_query_cache_with_comments_end.inc +++ /dev/null @@ -1,3 +0,0 @@ -DROP TABLE t1; -SET GLOBAL query_cache_size=default; -set global query_cache_strip_comments=OFF; diff --git a/mysql-test/include/percona_query_cache_with_comments_eval.inc b/mysql-test/include/percona_query_cache_with_comments_eval.inc deleted file mode 100644 index a409786d554..00000000000 --- a/mysql-test/include/percona_query_cache_with_comments_eval.inc +++ /dev/null @@ -1,7 +0,0 @@ -echo -----------------------------------------------------; -echo $query; -echo -----------------------------------------------------; ---source include/percona_query_cache_with_comments_show.inc -eval $query; -eval $query; ---source include/percona_query_cache_with_comments_show.inc diff --git a/mysql-test/include/percona_query_cache_with_comments_show.inc b/mysql-test/include/percona_query_cache_with_comments_show.inc deleted file mode 100644 index 71aa5211cfd..00000000000 --- a/mysql-test/include/percona_query_cache_with_comments_show.inc +++ /dev/null @@ -1,8 +0,0 @@ -let $show=show status like "Qcache_queries_in_cache"; -eval $show; -let $show=show status like "Qcache_inserts"; -eval $show; -let $show=show status like "Qcache_hits"; -eval $show; - - diff --git a/mysql-test/include/percona_query_response_time_flush.inc b/mysql-test/include/percona_query_response_time_flush.inc deleted file mode 100644 index 44bb320fe13..00000000000 --- a/mysql-test/include/percona_query_response_time_flush.inc +++ /dev/null @@ -1 +0,0 @@ -FLUSH QUERY_RESPONSE_TIME; diff --git a/mysql-test/include/percona_query_response_time_show.inc b/mysql-test/include/percona_query_response_time_show.inc deleted file mode 100644 index 761b2c6f0df..00000000000 --- a/mysql-test/include/percona_query_response_time_show.inc +++ /dev/null @@ -1,7 +0,0 @@ -SELECT c.count, -(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count, -(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as not_zero_region_count, -(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count -FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count > 0; -SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; -SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; diff --git a/mysql-test/include/percona_query_response_time_sleep.inc b/mysql-test/include/percona_query_response_time_sleep.inc deleted file mode 100644 index 40688b173b0..00000000000 --- a/mysql-test/include/percona_query_response_time_sleep.inc +++ /dev/null @@ -1,19 +0,0 @@ -SELECT SLEEP(0.31); -SELECT SLEEP(0.32); -SELECT SLEEP(0.33); -SELECT SLEEP(0.34); -SELECT SLEEP(0.35); -SELECT SLEEP(0.36); -SELECT SLEEP(0.37); -SELECT SLEEP(0.38); -SELECT SLEEP(0.39); -SELECT SLEEP(0.40); -SELECT SLEEP(1.1); -SELECT SLEEP(1.2); -SELECT SLEEP(1.3); -SELECT SLEEP(1.5); -SELECT SLEEP(1.4); -SELECT SLEEP(0.5); -SELECT SLEEP(2.1); -SELECT SLEEP(2.3); -SELECT SLEEP(2.5); diff --git a/mysql-test/include/rpl_diff_tables.inc b/mysql-test/include/rpl_diff_tables.inc index c3a45578a79..7fc68422c40 100644 --- a/mysql-test/include/rpl_diff_tables.inc +++ b/mysql-test/include/rpl_diff_tables.inc @@ -33,3 +33,4 @@ while (`SELECT "XX$_servers" <> "XX"`) --source include/diff_tables.inc connection $_slave; } +connection $_master; diff --git a/mysql-test/include/setup_fake_relay_log.inc b/mysql-test/include/setup_fake_relay_log.inc index 5b9e7f72fdd..f881f3bf4e8 100644 --- a/mysql-test/include/setup_fake_relay_log.inc +++ b/mysql-test/include/setup_fake_relay_log.inc @@ -56,7 +56,7 @@ if (`SELECT "$_sql_running" = "Yes" OR "$_io_running" = "Yes"`) { # Read server variables. let $MYSQLD_DATADIR= `SELECT @@datadir`; let $_fake_filename= query_get_value(SHOW VARIABLES LIKE 'relay_log', Value, 1); -if (`SELECT '$_fake_filename' = ''`) { +if (!$_fake_filename) { --echo Badly written test case: relay_log variable is empty. Please use the --echo server option --relay-log=FILE. } @@ -72,7 +72,7 @@ copy_file $fake_relay_log $_fake_relay_log; if (`SELECT LENGTH(@@secure_file_priv) > 0`) { - -- let $_file_priv_dir= `SELECT @@secure_file_priv`; + -- let $_file_priv_dir= `SELECT @@secure_file_priv` -- let $_suffix= `SELECT UUID()` -- let $_tmp_file= $_file_priv_dir/fake-index.$_suffix diff --git a/mysql-test/include/show_binlog_events.inc b/mysql-test/include/show_binlog_events.inc index 8649f31ad9f..6d8c8196102 100644 --- a/mysql-test/include/show_binlog_events.inc +++ b/mysql-test/include/show_binlog_events.inc @@ -27,14 +27,14 @@ if (!$binlog_start) } --let $_statement=show binlog events -if (`SELECT '$binlog_file' <> ''`) +if ($binlog_file) { --let $_statement= $_statement in '$binlog_file' } --let $_statement= $_statement from $binlog_start -if (`SELECT '$binlog_limit' <> ''`) +if ($binlog_limit) { --let $_statement= $_statement limit $binlog_limit } diff --git a/mysql-test/include/show_rpl_debug_info.inc b/mysql-test/include/show_rpl_debug_info.inc index 148d11f3b02..9944e6cd25f 100644 --- a/mysql-test/include/show_rpl_debug_info.inc +++ b/mysql-test/include/show_rpl_debug_info.inc @@ -48,13 +48,13 @@ let $binlog_name= query_get_value("SHOW MASTER STATUS", File, 1); eval SHOW BINLOG EVENTS IN '$binlog_name'; let $_master_con= $master_connection; -if (`SELECT '$_master_con' = ''`) +if (!$_master_con) { if (`SELECT '$_con' = 'slave'`) { let $_master_con= master; } - if (`SELECT '$_master_con' = ''`) + if (!$_master_con) { --echo Unable to determine master connection. No debug info printed for master. --echo Please fix the test case by setting $master_connection before sourcing @@ -62,7 +62,7 @@ if (`SELECT '$_master_con' = ''`) } } -if (`SELECT '$_master_con' != ''`) +if ($_master_con) { let $master_binlog_name_io= query_get_value("SHOW SLAVE STATUS", Master_Log_File, 1); diff --git a/mysql-test/include/wait_for_slave_io_error.inc b/mysql-test/include/wait_for_slave_io_error.inc index 34cbf20a73b..ffdcf752873 100644 --- a/mysql-test/include/wait_for_slave_io_error.inc +++ b/mysql-test/include/wait_for_slave_io_error.inc @@ -31,7 +31,7 @@ # $master_connection # See wait_for_slave_param.inc for description. -if (`SELECT '$slave_io_errno' = ''`) { +if (!$slave_io_errno) { --die !!!ERROR IN TEST: you must set \$slave_io_errno before sourcing wait_for_slave_io_error.inc } diff --git a/mysql-test/include/wait_for_slave_param.inc b/mysql-test/include/wait_for_slave_param.inc index ef864f9245e..98cd426fa11 100644 --- a/mysql-test/include/wait_for_slave_param.inc +++ b/mysql-test/include/wait_for_slave_param.inc @@ -51,7 +51,7 @@ if (!$_slave_timeout_counter) } let $_slave_param_comparison= $slave_param_comparison; -if (`SELECT '$_slave_param_comparison' = ''`) +if (!$_slave_param_comparison) { let $_slave_param_comparison= =; } @@ -71,7 +71,7 @@ while (`SELECT NOT('$_show_slave_status_value' $_slave_param_comparison '$slave_ if (!$_slave_timeout_counter) { --echo **** ERROR: timeout after $slave_timeout seconds while waiting for slave parameter $slave_param $_slave_param_comparison $slave_param_value **** - if (`SELECT '$slave_error_message' != ''`) + if ($slave_error_message) { --echo Message: $slave_error_message } diff --git a/mysql-test/include/wait_for_slave_sql_error.inc b/mysql-test/include/wait_for_slave_sql_error.inc index aab04036eea..80836f908c6 100644 --- a/mysql-test/include/wait_for_slave_sql_error.inc +++ b/mysql-test/include/wait_for_slave_sql_error.inc @@ -24,7 +24,7 @@ # $master_connection # See wait_for_slave_param.inc for description. -if (`SELECT '$slave_sql_errno' = ''`) { +if (!$slave_sql_errno) { --die !!!ERROR IN TEST: you must set \$slave_sql_errno before sourcing wait_for_slave_sql_error.inc } diff --git a/mysql-test/include/wait_for_status_var.inc b/mysql-test/include/wait_for_status_var.inc index b8b4fa20b86..c3d6599e4d2 100644 --- a/mysql-test/include/wait_for_status_var.inc +++ b/mysql-test/include/wait_for_status_var.inc @@ -45,7 +45,7 @@ if (!$_status_timeout_counter) } let $_status_var_comparsion= $status_var_comparsion; -if (`SELECT '$_status_var_comparsion' = ''`) +if (!$_status_var_comparsion) { let $_status_var_comparsion= =; } |