diff options
author | Georgi Kodinov <Georgi.Kodinov@Oracle.com> | 2010-09-20 17:17:32 +0300 |
---|---|---|
committer | Georgi Kodinov <Georgi.Kodinov@Oracle.com> | 2010-09-20 17:17:32 +0300 |
commit | 353739fdef95fb1765dbbadf14ce1a9849a36137 (patch) | |
tree | 4b2b7364d1e622b3b02db3fb9d0c898fb9293a87 /mysql-test/t | |
parent | 9fee5866beed47b55c5196acfa1a03503a13a2d7 (diff) | |
parent | f4444c0016c68feb3f300c4b30b886cd407f5824 (diff) | |
download | mariadb-git-353739fdef95fb1765dbbadf14ce1a9849a36137.tar.gz |
merge of mysql-5.5 into mysql-5.5-wl1054
Diffstat (limited to 'mysql-test/t')
60 files changed, 1787 insertions, 312 deletions
diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test index 076e32eb22c..42751b8ce06 100644 --- a/mysql-test/t/auto_increment.test +++ b/mysql-test/t/auto_increment.test @@ -334,7 +334,7 @@ INSERT INTO t1 VALUES (1), (1); CREATE TABLE t2 ( a INT AUTO_INCREMENT KEY ); --error ER_DUP_ENTRY -CREATE TABLE IF NOT EXISTS t2 AS SELECT a FROM t1; +INSERT INTO t2 SELECT a FROM t1; UPDATE t2 SET a = 2; diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test index 028c64d6de7..e1c807fe32b 100644 --- a/mysql-test/t/case.test +++ b/mysql-test/t/case.test @@ -111,6 +111,9 @@ explain extended SELECT SHOW CREATE TABLE t1; DROP TABLE t1; +--error 1267 +CREATE TABLE t1 SELECT IFNULL('a' COLLATE latin1_swedish_ci, 'b' COLLATE latin1_bin); + # Test for BUG#10151 SELECT 'case+union+test' UNION diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 887ae4da404..8181b873029 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -5,6 +5,7 @@ --disable_warnings drop table if exists t1,t2,t3,t4,t5; drop database if exists mysqltest; +drop view if exists v1; --enable_warnings create table t1 (b char(0)); @@ -232,7 +233,6 @@ drop table t1; create table t1 select 1,2,3; create table if not exists t1 select 1,2; ---error 1136 create table if not exists t1 select 1,2,3,4; create table if not exists t1 select 1; select * from t1; @@ -248,8 +248,6 @@ insert into t1 values (1,1); create table if not exists t1 select 2; select * from t1; create table if not exists t1 select 3 as 'a',4 as 'b'; ---error ER_DUP_ENTRY -create table if not exists t1 select 3 as 'a',3 as 'b'; show warnings; show status like "Opened_tables"; select * from t1; @@ -517,7 +515,7 @@ drop table t1,t2; # an improper fix is present. # create table t1 (a int); ---error 1093 +--error ER_TABLE_EXISTS_ERROR create table t1 select * from t1; --error ER_WRONG_OBJECT create table t2 union = (t1) select * from t1; @@ -730,7 +728,6 @@ create table t1 select coalesce('a' collate latin1_swedish_ci,'b' collate latin1 create table t1 (primary key(a)) select "b" as b; # Error in select_create::prepare() which is not related to table creation create table t1 (a int); ---error ER_WRONG_VALUE_COUNT_ON_ROW create table if not exists t1 select 1 as a, 2 as b; drop table t1; # Finally error which happens during insert @@ -742,20 +739,13 @@ create table t1 (i int); create table t1 select 1 as i; create table if not exists t1 select 1 as i; select * from t1; -# Error which is detected after successfull table open. ---error ER_UPDATE_TABLE_USED +# After WL#5370, it just generates a warning that the table already exists. create table if not exists t1 select * from t1; select * from t1; +drop table t1; # Error before select_create::prepare() --error ER_CANT_AGGREGATE_2COLLATIONS create table t1 select coalesce('a' collate latin1_swedish_ci,'b' collate latin1_bin); -select * from t1; -# Error which happens during insertion of rows -alter table t1 add primary key (i); ---error ER_DUP_ENTRY -create table if not exists t1 (select 2 as i) union all (select 2 as i); -select * from t1; -drop table t1; # Base vs temporary tables dillema (a.k.a. bug#24508 "Inconsistent @@ -1229,11 +1219,9 @@ INSERT IGNORE INTO t1 (b) VALUES (5); CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY) SELECT a FROM t1; --error 1062 -CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY) - SELECT a FROM t1; +INSERT INTO t2 SELECT a FROM t1; --error 1062 -CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY) - SELECT a FROM t1; +INSERT INTO t2 SELECT a FROM t1; DROP TABLE t1, t2; @@ -1273,7 +1261,7 @@ CREATE TEMPORARY TABLE t2 (primary key (a)) select * from t1; drop table if exists t2; CREATE TABLE t2 (a int, b int, primary key (a)); --error ER_DUP_ENTRY -CREATE TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1; +INSERT INTO t2 select * from t1; SELECT * from t2; TRUNCATE table t2; --error ER_DUP_ENTRY @@ -1283,11 +1271,7 @@ drop table t2; CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a)); --error ER_DUP_ENTRY -CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1; -SELECT * from t2; -TRUNCATE table t2; ---error ER_DUP_ENTRY -INSERT INTO t2 select * from t1; +INSERT INTO t2 SELECT * FROM t1; SELECT * from t2; drop table t1,t2; @@ -1657,11 +1641,7 @@ END ; | --delimiter ; --error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG -CREATE TABLE IF NOT EXISTS t1 ( - `pk` INTEGER NOT NULL AUTO_INCREMENT , - `int` INTEGER , - PRIMARY KEY ( `pk` ) -) SELECT `pk` , `int_key` FROM B ; +INSERT INTO t1 (pk, int_key) SELECT `pk` , `int_key` FROM B ; --delimiter | --error ER_NOT_SUPPORTED_YET @@ -1675,7 +1655,6 @@ END ;| DROP TABLE t1; DROP TABLE B; - --echo # --echo # Bug #47107 assert in notify_shared_lock on incorrect --echo # CREATE TABLE , HANDLER @@ -1798,3 +1777,243 @@ show create table t1; show create table t2; set @@sql_mode= @old_mode; drop tables t1, t2; +# +# Bug#47132 CREATE TABLE.. SELECT.. data not inserted if table +# is view over multiple tables +# + +CREATE TABLE t1 (id int); +CREATE TABLE t2 (id int); +INSERT INTO t1 VALUES (1), (1); +INSERT INTO t2 VALUES (2), (2); + +CREATE VIEW v1 AS SELECT id FROM t2; +CREATE TABLE IF NOT EXISTS v1(a int, b int) SELECT id, id FROM t1; +SHOW CREATE TABLE v1; +SELECT * FROM t2; +SELECT * FROM v1; +DROP VIEW v1; + +CREATE TEMPORARY TABLE tt1 AS SELECT id FROM t2; +CREATE TEMPORARY TABLE IF NOT EXISTS tt1(a int, b int) SELECT id, id FROM t1; +SELECT * FROM t2; +SELECT * FROM tt1; +DROP TEMPORARY TABLE tt1; + +DROP TABLE t1, t2; + + +--echo # +--echo # WL#5370 "Changing 'CREATE TABLE IF NOT EXISTS ... SELECT' +--echo # behaviour. +--echo # + +--echo # +--echo # 1. Basic case: a base table. +--echo # + +create table if not exists t1 (a int) select 1 as a; +select * from t1; +--error ER_TABLE_EXISTS_ERROR +create table t1 (a int) select 2 as a; +select * from t1; +--echo # Produces an essential warning ER_TABLE_EXISTS. +create table if not exists t1 (a int) select 2 as a; +--echo # No new data in t1. +select * from t1; +drop table t1; + +--echo # +--echo # 2. A temporary table. +--echo # + +create temporary table if not exists t1 (a int) select 1 as a; +select * from t1; +--error ER_TABLE_EXISTS_ERROR +create temporary table t1 (a int) select 2 as a; +select * from t1; +--echo # An essential warning. +create temporary table if not exists t1 (a int) select 2 as a; +--echo # No new data in t1. +select * from t1; +drop temporary table t1; + +--echo # +--echo # 3. Creating a base table in presence of a temporary table. +--echo # + +create table t1 (a int); +--echo # Create a view for convenience of querying t1 shadowed by a temp. +create view v1 as select a from t1; +drop table t1; +create temporary table t1 (a int) select 1 as a; +create table if not exists t1 (a int) select 2 as a; +select * from t1; +select * from v1; +--echo # Note: an essential warning. +create table if not exists t1 (a int) select 3 as a; +select * from t1; +select * from v1; +drop temporary table t1; +select * from t1; +drop view v1; +drop table t1; + +--echo # +--echo # 4. Creating a temporary table in presence of a base table. +--echo # + +create table t1 (a int) select 1 as a; +create temporary table if not exists t1 select 2 as a; +select * from t1; +--echo # Note: an essential warning. +create temporary table if not exists t1 select 3 as a; +select * from t1; +drop temporary table t1; +select * from t1; +drop table t1; + +--echo # +--echo # 5. Creating a base table in presence of an updatable view. +--echo # +create table t2 (a int unique); +create view t1 as select a from t2; +insert into t1 (a) values (1); +--error ER_TABLE_EXISTS_ERROR +create table t1 (a int); +--echo # Note: an essential warning. +create table if not exists t1 (a int); +--error ER_TABLE_EXISTS_ERROR +create table t1 (a int) select 2 as a; +select * from t1; +--echo # Note: an essential warning. +create table if not exists t1 (a int) select 2 as a; +select * from t1; +select * from t2; +create temporary table if not exists t1 (a int) select 3 as a; +select * from t1; +select * from t2; +--echo # Note: an essential warning. +create temporary table if not exists t1 (a int) select 4 as a; +select * from t1; +select * from t2; +drop temporary table t1; + +--echo # +--echo # Repeating the test with a non-updatable view. +--echo # +drop view t1; +create view t1 as select a + 5 as a from t2; +--error ER_NON_INSERTABLE_TABLE +insert into t1 (a) values (1); +--error ER_NONUPDATEABLE_COLUMN +update t1 set a=3 where a=2; + +--error ER_TABLE_EXISTS_ERROR +create table t1 (a int); +--echo # Note: an essential warning. +create table if not exists t1 (a int); +--error ER_TABLE_EXISTS_ERROR +create table t1 (a int) select 2 as a; +select * from t1; +--echo # Note: an essential warning. +create table if not exists t1 (a int) select 2 as a; +select * from t1; +select * from t2; +create temporary table if not exists t1 (a int) select 3 as a; +select * from t1; +select * from t2; +--echo # Note: an essential warning. +create temporary table if not exists t1 (a int) select 4 as a; +select * from t1; +select * from t2; +drop temporary table t1; +drop view t1; +drop table t2; + +--echo # +--echo # Repeating the test with a view select a constant number +--echo # +create view t1 as select 1 as a; +--error ER_NON_INSERTABLE_TABLE +insert into t1 (a) values (1); +--error ER_NON_UPDATABLE_TABLE +update t1 set a=3 where a=2; + +--error ER_TABLE_EXISTS_ERROR +create table t1 (a int); +--echo # Note: an essential warning. +create table if not exists t1 (a int); +--error ER_TABLE_EXISTS_ERROR +create table t1 (a int) select 2 as a; +select * from t1; +--echo # Note: an essential warning. +create table if not exists t1 (a int) select 2 as a; +select * from t1; +create temporary table if not exists t1 (a int) select 3 as a; +select * from t1; +--echo # Note: an essential warning. +create temporary table if not exists t1 (a int) select 4 as a; +select * from t1; +drop temporary table t1; +drop view t1; + + +--echo # +--echo # 6. Test of unique_table(). +--echo # + +create table t1 (a int) select 1 as a; +create temporary table if not exists t1 (a int) select * from t1; +--error ER_CANT_REOPEN_TABLE +create temporary table if not exists t1 (a int) select * from t1; +select * from t1; +drop temporary table t1; +select * from t1; +drop table t1; +create temporary table t1 (a int) select 1 as a; +create table if not exists t1 (a int) select * from t1; +create table if not exists t1 (a int) select * from t1; +select * from t1; +drop temporary table t1; +select * from t1; +drop table t1; +--error ER_NO_SUCH_TABLE +create table if not exists t1 (a int) select * from t1; + +--echo # +--echo # 7. Test of non-matching columns, REPLACE and IGNORE. +--echo # + +create table t1 (a int) select 1 as b, 2 as c; +select * from t1; +drop table t1; +create table if not exists t1 (a int, b date, c date) select 1 as b, 2 as c; +select * from t1; +drop table t1; +set @@session.sql_mode='STRICT_ALL_TABLES'; +--error ER_TRUNCATED_WRONG_VALUE +create table if not exists t1 (a int, b date, c date) select 1 as b, 2 as c; +--error ER_NO_SUCH_TABLE +select * from t1; +--error ER_TRUNCATED_WRONG_VALUE +create table if not exists t1 (a int, b date, c date) + replace select 1 as b, 2 as c; +--error ER_NO_SUCH_TABLE +select * from t1; + +create table if not exists t1 (a int, b date, c date) + ignore select 1 as b, 2 as c; +select * from t1; +set @@session.sql_mode=default; +drop table t1; + +create table if not exists t1 (a int unique, b int) + replace select 1 as a, 1 as b union select 1 as a, 2 as b; +select * from t1; +drop table t1; +create table if not exists t1 (a int unique, b int) + ignore select 1 as a, 1 as b union select 1 as a, 2 as b; +select * from t1; +drop table t1; +--echo # diff --git a/mysql-test/t/ctype_utf16.test b/mysql-test/t/ctype_utf16.test index e9c7e569250..ef705474eee 100644 --- a/mysql-test/t/ctype_utf16.test +++ b/mysql-test/t/ctype_utf16.test @@ -326,6 +326,7 @@ SET collation_connection='utf16_general_ci'; SET NAMES latin1; SET collation_connection='utf16_bin'; -- source include/ctype_filesort.inc +-- source include/ctype_filesort2.inc -- source include/ctype_like_escape.inc # diff --git a/mysql-test/t/ctype_utf16_def-master.opt b/mysql-test/t/ctype_utf16_def-master.opt new file mode 100644 index 00000000000..55bb5d14bbd --- /dev/null +++ b/mysql-test/t/ctype_utf16_def-master.opt @@ -0,0 +1 @@ +--character-set-server=utf16,latin1 diff --git a/mysql-test/t/ctype_utf16_def.test b/mysql-test/t/ctype_utf16_def.test new file mode 100644 index 00000000000..d8ef4a4278b --- /dev/null +++ b/mysql-test/t/ctype_utf16_def.test @@ -0,0 +1,8 @@ +--source include/have_utf16.inc + +# +# Bug #32391 Character sets: crash with --character-set-server +# +SHOW VARIABLES LIKE 'collation_server'; +SHOW VARIABLES LIKE 'character_set_server'; +SHOW VARIABLES LIKE 'ft_stopword_file'; diff --git a/mysql-test/t/ctype_utf32.test b/mysql-test/t/ctype_utf32.test index 96f1a341d38..b03284a1c7c 100644 --- a/mysql-test/t/ctype_utf32.test +++ b/mysql-test/t/ctype_utf32.test @@ -328,6 +328,7 @@ SET collation_connection='utf32_general_ci'; SET NAMES latin1; SET collation_connection='utf32_bin'; -- source include/ctype_filesort.inc +-- source include/ctype_filesort2.inc -- source include/ctype_like_escape.inc # @@ -800,6 +801,35 @@ CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; SHOW CREATE TABLE t2; DROP TABLE t1, t2; + +--echo # +--echo # Bug#45263 utf32_general_ci, bad effects around CREATE TABLE AS SELECT +--echo # +SET collation_connection=utf32_general_ci; +CREATE TABLE t1 AS SELECT HEX(0x00) AS my_col; +SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # Bug#55912 FORMAT with locale set fails for numbers < 1000 +--echo # +SET collation_connection=utf32_general_ci; +CREATE TABLE t1 AS SELECT format(123,2,'no_NO'); +SHOW CREATE TABLE t1; +SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # Bug#42511 mysqld: ctype-ucs2.c:2044: my_strnncollsp_utf32: Assertion (tlen % 4) == 0' faied +--echo # +CREATE TABLE t1 ( + b char(250) CHARACTER SET utf32, + key (b) +) ENGINE=MYISAM; +INSERT INTO t1 VALUES ('d'),('f'); +SELECT * FROM t1 WHERE b BETWEEN 'a' AND 'z'; +DROP TABLE t1; + --echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index f2287488a4f..5b665e24958 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -1505,6 +1505,11 @@ CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; SHOW CREATE TABLE t2; DROP TABLE t1, t2; + +SET NAMES utf8; +--source include/ctype_numconv.inc + + --echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/ctype_utf8mb4.test b/mysql-test/t/ctype_utf8mb4.test index 8fcba92ff47..03696f385b5 100644 --- a/mysql-test/t/ctype_utf8mb4.test +++ b/mysql-test/t/ctype_utf8mb4.test @@ -733,6 +733,7 @@ SET collation_connection='utf8mb4_general_ci'; -- source include/ctype_german.inc SET collation_connection='utf8mb4_bin'; -- source include/ctype_filesort.inc +-- source include/ctype_filesort2.inc -- source include/ctype_like_escape.inc # diff --git a/mysql-test/t/delayed.test b/mysql-test/t/delayed.test index 142f1b241d6..5f56cdf54e1 100644 --- a/mysql-test/t/delayed.test +++ b/mysql-test/t/delayed.test @@ -307,7 +307,7 @@ connection update; connection default; let $wait_condition= select count(*) = 1 from information_schema.processlist - where command = "Delayed insert" and state = "Table lock"; + where command = "Delayed insert" and state = "Waiting for table level lock"; --source include/wait_condition.inc connect (select,localhost,root,,); --echo connection: select @@ -388,3 +388,167 @@ CREATE TABLE t1 LIKE t2; DROP TABLE t2; DROP TABLE t1; + + +--echo # +--echo # Bug#54332 Deadlock with two connections doing LOCK TABLE+INSERT DELAYED +--echo # + +--echo # This test is not supposed to work under --ps-protocol since +--echo # INSERT DELAYED doesn't work under LOCK TABLES with this protocol. +--disable_ps_protocol + +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings + +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a INT); +CREATE TABLE t3 (a INT); + +--echo # Test 1: Using LOCK TABLE + +--echo # Connection con1 +connect (con1, localhost, root); +LOCK TABLE t1 WRITE; + +--echo # Connection default +connection default; +LOCK TABLE t2 WRITE; +--echo # Sending: +--send INSERT DELAYED INTO t1 VALUES (1) + +--echo # Connection con1 +connection con1; +--echo # Wait until INSERT DELAYED is blocked on table 't1'. +let $wait_condition= + SELECT COUNT(*) = 1 FROM information_schema.processlist + WHERE state = "Waiting for table metadata lock" + AND info = "INSERT DELAYED INTO t1 VALUES (1)"; +--source include/wait_condition.inc +--error ER_LOCK_DEADLOCK +INSERT DELAYED INTO t2 VALUES (1); +UNLOCK TABLES; + +--echo # Connection default +connection default; +--echo # Reaping: INSERT DELAYED INTO t1 VALUES (1) +--reap +UNLOCK TABLES; + +--echo # Test 2: Using ALTER TABLE + +START TRANSACTION; +SELECT * FROM t1 WHERE a=0; + +--echo # Connection con1 +connection con1; +--echo # Sending: +--send ALTER TABLE t1 COMMENT 'test' + +--echo # Connection default +connection default; +--echo # Wait until ALTER TABLE is blocked on table 't1'. +let $wait_condition= + SELECT COUNT(*) = 1 FROM information_schema.processlist + WHERE state = "Waiting for table metadata lock" + AND info = "ALTER TABLE t1 COMMENT 'test'"; +--source include/wait_condition.inc +--error ER_LOCK_DEADLOCK +INSERT DELAYED INTO t1 VALUES (3); +COMMIT; + +--echo # Connection con1 +connection con1; +--echo # Reaping: ALTER TABLE t1 COMMENT 'test' +--reap + +--echo # Test 3: Using RENAME TABLE + +--echo # Connection default +connection default; +START TRANSACTION; +INSERT INTO t2 VALUES (1); + +--echo # Connection con1 +connection con1; +--echo # Sending: +--send RENAME TABLE t1 to t5, t2 to t4 + +--echo # Connection default +connection default; +--echo # Wait until RENAME TABLE is blocked on table 't1'. +let $wait_condition= + SELECT COUNT(*) = 1 FROM information_schema.processlist + WHERE state = "Waiting for table metadata lock" + AND info = "RENAME TABLE t1 to t5, t2 to t4"; +--source include/wait_condition.inc +--error ER_LOCK_DEADLOCK +INSERT DELAYED INTO t1 VALUES (4); +COMMIT; + +--echo # Connection con1 +connection con1; +--echo # Reaping: RENAME TABLE t1 to t5, t2 to t4 +--reap + +--echo # Connection default +connection default; +--echo # Reverting the renames +RENAME TABLE t5 to t1, t4 to t2; + +--echo # Test 4: Two INSERT DELAYED on the same table + +START TRANSACTION; +INSERT INTO t2 VALUES (1); + +--echo # Connection con2 +connect (con2, localhost, root); +--send LOCK TABLE t1 WRITE, t2 WRITE + +--echo # Connection con1 +connection con1; +--echo # Wait until LOCK TABLE is blocked on table 't2'. +let $wait_condition= + SELECT COUNT(*) = 1 FROM information_schema.processlist + WHERE state = "Waiting for table metadata lock" + AND info = "LOCK TABLE t1 WRITE, t2 WRITE"; +--source include/wait_condition.inc +--send INSERT DELAYED INTO t1 VALUES (5) + +--echo # Connection default +connection default; +--echo # Wait until INSERT DELAYED is blocked on table 't1'. +let $wait_condition= + SELECT COUNT(*) = 1 FROM information_schema.processlist + WHERE state = "Waiting for table metadata lock" + AND info = "INSERT DELAYED INTO t1 VALUES (5)"; +--source include/wait_condition.inc +--error ER_LOCK_DEADLOCK +INSERT DELAYED INTO t1 VALUES (6); +COMMIT; + +--echo # Connection con2 +connection con2; +--echo # Reaping: LOCK TABLE t1 WRITE, t2 WRITE +--reap +UNLOCK TABLES; + +--echo # Connection con1 +connection con1; +--echo # Reaping: INSERT DELAYED INTO t1 VALUES (5) +--reap + +--echo # Connection con2 +connection con2; +disconnect con2; +--source include/wait_until_disconnected.inc +--echo # Connection con1 +connection con1; +disconnect con1; +--source include/wait_until_disconnected.inc + +--echo # Connection default +connection default; +DROP TABLE t1, t2, t3; +--enable_ps_protocol diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test index a21fff60d33..15aade73ab7 100644 --- a/mysql-test/t/delete.test +++ b/mysql-test/t/delete.test @@ -540,4 +540,17 @@ DELETE FROM t1 WHERE a = 10 OR b = 20 ORDER BY c LIMIT 1; DROP TABLE t1; +--echo # +--echo # Bug #53034: Multiple-table DELETE statements not accepting +--echo # "Access compatibility" syntax +--echo # + +CREATE TABLE t1 (id INT); +CREATE TABLE t2 LIKE t1; +CREATE TABLE t3 LIKE t1; + +DELETE FROM t1.*, test.t2.*, a.* USING t1, t2, t3 AS a; + +DROP TABLE t1, t2, t3; + --echo End of 5.1 tests diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 62d11e35922..8a1f91086d2 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -11,9 +11,10 @@ ############################################################################## kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild. lowercase_table3 : Bug#54845 2010-06-30 alik main.lowercase_table3 on Mac OSX -mysqlhotcopy_myisam : bug#54129 2010-06-04 Horst -mysqlhotcopy_archive : bug#54129 2010-06-04 Horst -plugin_load : Bug#42144 2009-12-21 alik plugin_load fails partition_innodb_plugin : Bug#53307 2010-04-30 VasilDimov valgrind warnings +plugin : Bug#55966 2010-08-13 alik "plugin" tests fail in 5.5 +plugin_load : Bug#55966 2010-08-13 alik "plugin" tests fail in 5.5 +plugin_not_embedded : Bug#55966 2010-08-13 alik "plugin" tests fail in 5.5 query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically sp_sync : Bug#48157 2010-02-06 5.5-m3 demands a differnt solution +ctype_utf8mb4_ndb : Bug#55799, Bug#51907, disabled by Konstantin 2010-08-06 diff --git a/mysql-test/t/endspace.test b/mysql-test/t/endspace.test index b223c683cde..7c71b05f687 100644 --- a/mysql-test/t/endspace.test +++ b/mysql-test/t/endspace.test @@ -27,7 +27,7 @@ alter table t1 modify text1 char(32) binary not null; check table t1; select * from t1 ignore key (key1) where text1='teststring' or text1 like 'teststring_%' ORDER BY text1; -select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%'; +select concat('|', text1, '|') as c from t1 where text1='teststring' or text1 like 'teststring_%' order by c; select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t'; select text1, length(text1) from t1 order by text1; select text1, length(text1) from t1 order by binary text1; @@ -44,14 +44,14 @@ select concat('|', text1, '|') from t1 where text1='teststring'; select concat('|', text1, '|') from t1 where text1='teststring '; explain select concat('|', text1, '|') from t1 where text1='teststring '; select concat('|', text1, '|') from t1 where text1 like 'teststring_%'; -select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%'; +select concat('|', text1, '|') as c from t1 where text1='teststring' or text1 like 'teststring_%' order by c; select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t'; select concat('|', text1, '|') from t1 order by text1; drop table t1; create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)) pack_keys=0; insert into t1 values ('teststring'), ('nothing'), ('teststring\t'); -select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%'; +select concat('|', text1, '|') as c from t1 where text1='teststring' or text1 like 'teststring_%' order by c; select concat('|', text1, '|') from t1 where text1='teststring' or text1 >= 'teststring\t'; drop table t1; diff --git a/mysql-test/t/events_trans.test b/mysql-test/t/events_trans.test index a94b75bb812..4cf2583ac96 100644 --- a/mysql-test/t/events_trans.test +++ b/mysql-test/t/events_trans.test @@ -121,3 +121,28 @@ let $wait_condition= drop database events_test; + +--echo # +--echo # Bug#54105 assert in MDL_context::release_locks_stored_before +--echo # + +USE test; + +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +DROP EVENT IF EXISTS e1; +--enable_warnings + +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +CREATE TABLE t2 (a INT); +CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; + +START TRANSACTION; +INSERT INTO t1 VALUES (1); +SAVEPOINT A; +--replace_regex /STARTS '[^']+'/STARTS '#'/ +SHOW CREATE EVENT e1; +SELECT * FROM t2; +ROLLBACK WORK TO SAVEPOINT A; + +DROP TABLE t1, t2; diff --git a/mysql-test/t/flush.test b/mysql-test/t/flush.test index 0d406338394..d4c3533847d 100644 --- a/mysql-test/t/flush.test +++ b/mysql-test/t/flush.test @@ -318,6 +318,58 @@ insert into t2 (a) values (3); --echo # --> connection default; connection default; unlock tables; +--echo # +--echo # Check that "FLUSH TABLES <list> WITH READ LOCK" is +--echo # compatible with active "FLUSH TABLES WITH READ LOCK". +--echo # Vice versa it is not true, since tables read-locked by +--echo # "FLUSH TABLES <list> WITH READ LOCK" can't be flushed. +flush tables with read lock; +--echo # --> connection con1; +connection con1; +flush table t1 with read lock; +select * from t1; +unlock tables; +--echo # --> connection default; +connection default; +unlock tables; +--echo # +--echo # Check that FLUSH TABLES t1 WITH READ LOCK +--echo # does not conflict with an existing FLUSH TABLES t2 +--echo # WITH READ LOCK. +--echo # +flush table t1 with read lock; +--echo # --> connection con1 +connection con1; +flush table t2 with read lock; +unlock tables; +--echo # --> connection default +connection default; +unlock tables; +--echo # +--echo # Check that FLUSH TABLES t1 WITH READ LOCK +--echo # does not conflict with SET GLOBAL read_only=1. +--echo # +set global read_only=1; +--echo # connection con1 +connection con1; +flush table t1 with read lock; +unlock tables; +--echo # connection default +connection default; +set global read_only=0; +--echo # +--echo # Check that it's possible to read-lock +--echo # tables locked with FLUSH TABLE <list> WITH READ LOCK. +--echo # +flush tables t1, t2 with read lock; +--echo # connection con1 +connection con1; +lock table t1 read, t2 read; +unlock tables; +--echo # connection default +connection default; +unlock tables; + --echo # --> connection con1 connection con1; disconnect con1; @@ -355,3 +407,142 @@ drop temporary table v1; unlock tables; drop view v2, v3; drop table t1, v1; + + +--echo # +--echo # FLUSH TABLES <list> WITH READ LOCK and HANDLER +--echo # +--disable_warnings +drop table if exists t1; +--enable_warnings +create table t1 (a int, key a (a)); +insert into t1 (a) values (1), (2), (3); +handler t1 open; +handler t1 read a next; +handler t1 read a next; +flush tables t1 with read lock; +--error ER_LOCK_OR_ACTIVE_TRANSACTION +handler t1 read a next; +unlock tables; +--echo # +--echo # Sic: lost handler position. +--echo # +handler t1 read a next; +handler t1 close; +drop table t1; + +--echo # +--echo # Bug#52117 Pending FLUSH TALBES <list> aborts +--echo # transactions unnecessarily. +--echo # +--disable_warnings +drop table if exists t1; +--enable_warnings +connect (con1,localhost,root,,); +connect (con2,localhost,root,,); +--echo # --> conection default +connection default; + +create table t1 (a int); +begin; +select * from t1; +--echo # --> connection con1 +connection con1; +--echo # +--echo # Issue a LOCK TABLE t1 READ. We could use HANDLER t1 OPEN +--echo # or a long-running select -- anything that +--echo # prevents FLUSH TABLE t1 from immediate completion would do. +--echo # +lock table t1 read; +--echo # --> connection con2 +connection con2; +--echo # +--echo # FLUSH TABLE expels the table definition from the cache. +--echo # Sending 'flush table t1'... +send flush table t1; +--echo # --> connection default +connection default; +--echo # Let flush table sync in. +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table flush" + and info = "flush table t1"; +--source include/wait_condition.inc +send select * from t1; +--echo # --> connection con1 +connection con1; +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table flush" + and info = "select * from t1"; +select * from t1; +unlock tables; +--echo # --> connection con2 +connection con2; +--echo # Reaping 'flush table t1'... +reap; +--echo # --> connection default +connection default; +--echo # Reaping 'select * from t1'... +reap; +commit; + +--echo # +--echo # Repeat the same test but with FLUSH TABLES +--echo # + +begin; +select * from t1; +--echo # --> connection con1 +connection con1; +--echo # +--echo # Issue a LOCK TABLE t1 READ. +--echo # +lock table t1 read; +--echo # --> connection con2 +connection con2; +--echo # +--echo # FLUSH TABLES expels the table definition from the cache. +--echo # Sending 'flush tables'... +send flush tables; +--echo # --> connection default +connection default; +--echo # Let flush table sync in. +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table flush" + and info = "flush tables"; +--source include/wait_condition.inc +send select * from t1; +--echo # --> connection con1 +connection con1; +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table flush" + and info = "select * from t1"; +select * from t1; +unlock tables; +--echo # --> connection con2 +connection con2; +--echo # Reaping 'flush tables'... +reap; +--echo # --> connection default +connection default; +--echo # Reaping 'select * from t1'... +reap; +commit; + +--echo # Cleanup + +--echo # --> connection con1 +connection con1; +disconnect con1; +--source include/wait_until_disconnected.inc +--echo # --> connection con2 +connection con2; +disconnect con2; +--source include/wait_until_disconnected.inc +--echo # --> connection default +connection default; +drop table t1; + diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index e191b9750e3..36a8542f9eb 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -708,6 +708,7 @@ SELECT 1 FROM DROP TABLE t1; +--echo End of 5.0 tests --echo # --echo # Bug #52397: another crash with explain extended and group_concat @@ -722,6 +723,26 @@ DROP TABLE t1; --echo End of 5.0 tests + +--echo # +--echo # Bug #54476: crash when group_concat and 'with rollup' in prepared statements +--echo # + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1), (2); + +PREPARE stmt FROM "SELECT GROUP_CONCAT(t1.a ORDER BY t1.a) FROM t1 JOIN t1 t2 GROUP BY t1.a WITH ROLLUP"; +EXECUTE stmt; +EXECUTE stmt; + +DEALLOCATE PREPARE stmt; +DROP TABLE t1; + + +--echo End of 5.1 tests + + + # # Bug#36785: Wrong error message when group_concat() exceeds max length # diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index 2914bb15d18..6d128be7f34 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -1082,11 +1082,25 @@ select a.f1 as a, b.f4 as b, a.f1 > b.f4 as gt, from t1 a, t1 b; select *, f1 = f2 from t1; drop table t1; + +--echo # +--echo # Bug #54465: assert: field_types == 0 || field_types[field_pos] == +--echo # MYSQL_TYPE_LONGLONG +--echo # + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1), (2); + +SELECT MAX((SELECT 1 FROM t1 ORDER BY @var LIMIT 1)) m FROM t1 t2, t1 + ORDER BY t1.a; + +DROP TABLE t1; + --echo # --echo End of 5.1 tests --echo # ---echo # Bug#55648: Server crash on MIX/MAX on maximum time value +--echo # Bug#55648: Server crash on MIN/MAX on maximum time value --echo # CREATE TABLE t1(c1 TIME NOT NULL); INSERT INTO t1 VALUES('837:59:59'); @@ -1095,3 +1109,12 @@ SELECT MAX(c1) FROM t1; DROP TABLE t1; --echo # End of the bug#55648 +--echo # +--echo # Bug#56120: Failed assertion on MIN/MAX on negative time value +--echo # +CREATE TABLE t1(c1 TIME NOT NULL); +INSERT INTO t1 VALUES('-00:00:01'); +SELECT MAX(c1),MIN(c1) FROM t1; +DROP TABLE t1; +--echo # End of the bug#56120 + diff --git a/mysql-test/t/func_if.test b/mysql-test/t/func_if.test index 4efea8e195e..91f70bb98d7 100644 --- a/mysql-test/t/func_if.test +++ b/mysql-test/t/func_if.test @@ -165,3 +165,15 @@ DROP TABLE t1; --echo End of 5.0 tests + + +--echo # +--echo # Bug#55077: Assertion failed: width > 0 && to != ((void *)0), file .\dtoa.c +--echo # + +CREATE TABLE t1 (a LONGBLOB, b DOUBLE); +INSERT INTO t1 VALUES (NULL, 0), (NULL, 1); + +SELECT IF(b, (SELECT a FROM t1 LIMIT 1), b) c FROM t1 GROUP BY c; + +DROP TABLE t1; diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test index a60eb9cf845..f6dd6478a93 100644 --- a/mysql-test/t/func_misc.test +++ b/mysql-test/t/func_misc.test @@ -468,6 +468,19 @@ select NAME_CONST('_id',1234) as id; select connection_id() > 0; --echo # +--echo # Bug #54461: crash with longblob and union or update with subquery +--echo # + +CREATE TABLE t1 (a INT, b LONGBLOB); +INSERT INTO t1 VALUES (1, '2'), (2, '3'), (3, '2'); + +SELECT DISTINCT LEAST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1; +SELECT DISTINCT GREATEST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1; + +DROP TABLE t1; + + +--echo # --echo # Bug #52165: Assertion failed: file .\dtoa.c, line 465 --echo # @@ -478,4 +491,5 @@ SELECT COALESCE(a) = COALESCE(b) FROM t1; DROP TABLE t1; + --echo End of tests diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index 10d35b16315..7b7bffd0bbc 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -1404,3 +1404,20 @@ SELECT format(123, 1, 'Non-existent-locale'); --echo End of 5.4 tests +--echo # +--echo # Start of 5.5 tests +--echo # + +--echo # +--echo # Bug#55912 FORMAT with locale set fails for numbers < 1000 +--echo # +SELECT FORMAT(123.33, 2, 'no_NO'), FORMAT(1123.33, 2, 'no_NO'); +SELECT FORMAT(12333e-2, 2, 'no_NO'), FORMAT(112333e-2, 2, 'no_NO'); +CREATE TABLE t1 AS SELECT format(123,2,'no_NO'); +SHOW CREATE TABLE t1; +SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # End of 5.5 tests +--echo # diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 219a857a597..1f6001219a3 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -821,4 +821,15 @@ select date_sub("0069-01-01 00:00:01",INTERVAL 2 SECOND); select date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND); +# +# Bug #55565: debug assertion when ordering by expressions with user +# variable assignments +# + +CREATE TABLE t1(a DOUBLE NOT NULL); +INSERT INTO t1 VALUES (0),(9.216e-096); +--echo # should not crash +SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a); +DROP TABLE t1; + --echo End of 5.1 tests diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index f46a20b2db4..2fb73af0c99 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -1222,6 +1222,20 @@ DROP TABLE t1, t2; --echo # +--echo # Bug#55188: GROUP BY, GROUP_CONCAT and TEXT - inconsistent results +--echo # + +CREATE TABLE t1 (a text, b varchar(10)); +INSERT INTO t1 VALUES (repeat('1', 1300),'one'), (repeat('1', 1300),'two'); + +query_vertical EXPLAIN +SELECT SUBSTRING(a,1,10), LENGTH(a), GROUP_CONCAT(b) FROM t1 GROUP BY a; +SELECT SUBSTRING(a,1,10), LENGTH(a), GROUP_CONCAT(b) FROM t1 GROUP BY a; +query_vertical EXPLAIN +SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a; +SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a; +DROP TABLE t1; + --echo # End of 5.1 tests diff --git a/mysql-test/t/handler_read_last.test b/mysql-test/t/handler_read_last.test new file mode 100644 index 00000000000..376829b9baf --- /dev/null +++ b/mysql-test/t/handler_read_last.test @@ -0,0 +1,40 @@ +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# +# 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, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 (a INT, INDEX (a)); +INSERT INTO t1 VALUES (),(),(),(),(),(),(),(),(),(); + +FLUSH STATUS; +SELECT a FROM t1 ORDER BY a LIMIT 1; +SHOW STATUS LIKE 'HANDLER_READ%'; + +FLUSH STATUS; +SELECT a FROM t1 ORDER BY a DESC LIMIT 1; +SHOW STATUS LIKE 'HANDLER_READ%'; + +FLUSH STATUS; +SELECT a FROM t1 ORDER BY a LIMIT 3; +SHOW STATUS LIKE 'HANDLER_READ%'; + +FLUSH STATUS; +SELECT a FROM t1 ORDER BY a DESC LIMIT 3; +SHOW STATUS LIKE 'HANDLER_READ%'; + +DROP TABLE t1; + diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index 87022d65fcc..f5fab966bdd 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -1470,7 +1470,8 @@ connection con3726_2; connection default; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info like "rename table t2 to t3"; + where state = "Waiting for table metadata lock" and + info like "rename table t2 to t3"; --source include/wait_condition.inc --echo # These statements should not be blocked by pending lock requests select table_name, column_name, data_type from information_schema.columns diff --git a/mysql-test/t/information_schema_inno.test b/mysql-test/t/information_schema_inno.test index 1a537d740b7..657d0effd7e 100644 --- a/mysql-test/t/information_schema_inno.test +++ b/mysql-test/t/information_schema_inno.test @@ -89,3 +89,23 @@ from information_schema.referential_constraints where constraint_schema = schema(); drop table t2; set foreign_key_checks = 1; + + +--echo # +--echo # Bug#55973 Assertion `thd->transaction.stmt.is_empty()' +--echo # on CREATE TABLE .. SELECT I_S.PART +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1; +DROP VIEW IF EXISTS v1; +--enable_warnings + +CREATE VIEW v1 AS SELECT 1; +# This used to case an assert. +CREATE TABLE t1 engine = InnoDB AS + SELECT * FROM information_schema.partitions + WHERE table_schema= 'test' AND table_name= 'v1'; + +DROP TABLE t1; +DROP VIEW v1; diff --git a/mysql-test/t/innodb_mysql_lock.test b/mysql-test/t/innodb_mysql_lock.test index c8ece729b19..975444a44b1 100644 --- a/mysql-test/t/innodb_mysql_lock.test +++ b/mysql-test/t/innodb_mysql_lock.test @@ -42,7 +42,7 @@ let $wait_condition= let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE info = "DROP TABLE t1" and - state = "Waiting for table"; + state = "Waiting for table metadata lock"; --source include/wait_condition.inc --echo # Connection 1 is now holding the lock. --echo # Issuing insert from connection 1 while connection 2&3 @@ -97,7 +97,8 @@ connection default; --echo # connection holds SW metadata lock on table to be altered. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "alter table t1 add column c4 int"; + where state = "Waiting for table metadata lock" and + info = "alter table t1 add column c4 int"; --source include/wait_condition.inc --echo # The below statement should succeed. It should not @@ -196,7 +197,7 @@ connection default; --echo # Connection con1 connection con1; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist - WHERE state='Waiting for table' AND info='OPTIMIZE TABLE t1'; + WHERE state='Waiting for table metadata lock' AND info='OPTIMIZE TABLE t1'; --source include/wait_condition.inc SELECT * FROM t1; COMMIT; @@ -241,7 +242,7 @@ connection con2; --echo # Waiting for 'SELECT * FROM v1' to sync in. let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist - WHERE state = "Waiting for table" AND info = "SELECT * FROM v1"; + WHERE state = "Waiting for table metadata lock" AND info = "SELECT * FROM v1"; --source include/wait_condition.inc # This should block due to v1 being locked. --echo # Sending: @@ -252,7 +253,8 @@ connection con3; --echo # Waiting for 'ALTER VIEW v1 AS SELECT 2 FROM t2' to sync in. let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist - WHERE state = "Waiting for table" AND info = "ALTER VIEW v1 AS SELECT 2 FROM t2"; + WHERE state = "Waiting for table metadata lock" AND + info = "ALTER VIEW v1 AS SELECT 2 FROM t2"; --source include/wait_condition.inc # Unlock t1 allowing SELECT * FROM v1 to proceed. UNLOCK TABLES; diff --git a/mysql-test/t/innodb_mysql_lock2.test b/mysql-test/t/innodb_mysql_lock2.test index 4ad30b9f25b..b7259e771ae 100644 --- a/mysql-test/t/innodb_mysql_lock2.test +++ b/mysql-test/t/innodb_mysql_lock2.test @@ -799,8 +799,9 @@ connection default; --echo # table as it acquires LOCK_S locks on rows of old version, which --echo # are compatible with locks acquired by connection 'con1'. let $wait_condition= - select count(*) = 1 from information_schema.processlist where state = - "Waiting for table" and info = "alter table t1 add column j int"; + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "alter table t1 add column j int"; --source include/wait_condition.inc --echo # The below statement will deadlock because it will try to acquire @@ -844,7 +845,8 @@ connection default; --echo # Wait until ALTER is blocked because of active SR lock. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "alter table t1 rebuild partition p0"; + where state = "Waiting for table metadata lock" and + info = "alter table t1 rebuild partition p0"; --source include/wait_condition.inc --echo # The below statement should succeed as transaction diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test index 4f918504597..2bf543511ac 100644 --- a/mysql-test/t/insert.test +++ b/mysql-test/t/insert.test @@ -525,3 +525,28 @@ drop table t1; --echo # --echo # End of 5.4 tests --echo # + +--echo # +--echo # Bug#54106 assert in Protocol::end_statement, +--echo # INSERT IGNORE ... SELECT ... UNION SELECT ... +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 (a INT); + +--error ER_FIELD_SPECIFIED_TWICE +INSERT INTO t1 (a, a) VALUES (1, 1); +# Verify that ER_FIELD_SPECIFIED_TWICE is not ignorable +--error ER_FIELD_SPECIFIED_TWICE +INSERT IGNORE t1 (a, a) VALUES (1, 1); + +--error ER_FIELD_SPECIFIED_TWICE +INSERT IGNORE t1 (a, a) SELECT 1,1; +# Used to cause an assert +--error ER_FIELD_SPECIFIED_TWICE +INSERT IGNORE t1 (a, a) SELECT 1,1 UNION SELECT 2,2; + +DROP TABLE t1; diff --git a/mysql-test/t/insert_notembedded.test b/mysql-test/t/insert_notembedded.test index 510dc56e8f7..4e5fe6f6755 100644 --- a/mysql-test/t/insert_notembedded.test +++ b/mysql-test/t/insert_notembedded.test @@ -174,7 +174,7 @@ connection default; # we must wait till the insert opens and locks the table let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Table lock" and id = $ID; + where state = "Waiting for table level lock" and id = $ID; --source include/wait_condition.inc connect (select,localhost,root,,); --echo connection: select diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test index b91feb3a1d5..706c2514d92 100644 --- a/mysql-test/t/kill.test +++ b/mysql-test/t/kill.test @@ -357,7 +357,8 @@ let $ID= `select connection_id()`; connection default; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "rename table t1 to t2"; + where state = "Waiting for table metadata lock" and + info = "rename table t1 to t2"; --source include/wait_condition.inc --replace_result $ID ID eval kill query $ID; @@ -372,7 +373,7 @@ connection ddl; connection default; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and + where state = "Waiting for table metadata lock" and info = "drop table t1"; --source include/wait_condition.inc --replace_result $ID ID @@ -388,7 +389,7 @@ connection ddl; connection default; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and + where state = "Waiting for table metadata lock" and info = "create trigger t1_bi before insert on t1 for each row set @a:=1"; --source include/wait_condition.inc --replace_result $ID ID @@ -407,7 +408,7 @@ connection ddl; connection default; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and + where state = "Waiting for table metadata lock" and info = "alter table t1 add column j int"; --source include/wait_condition.inc --replace_result $ID ID @@ -423,7 +424,7 @@ connection ddl; connection default; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and + where state = "Waiting for table metadata lock" and info = "alter table t1 rename to t2"; --source include/wait_condition.inc --replace_result $ID ID @@ -437,7 +438,7 @@ connection ddl; connection default; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and + where state = "Waiting for table metadata lock" and info = "alter table t1 disable keys"; --source include/wait_condition.inc --replace_result $ID ID @@ -452,7 +453,7 @@ connection ddl; connection default; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and + where state = "Waiting for table metadata lock" and info = "alter table t1 alter column i set default 100"; --source include/wait_condition.inc --replace_result $ID ID @@ -474,7 +475,7 @@ connection ddl; connection default; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and + where state = "Waiting for table metadata lock" and info = "alter table t2 alter column i set default 100"; --source include/wait_condition.inc --replace_result $ID ID @@ -499,7 +500,7 @@ connection ddl; connection dml; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and + where state = "Waiting for table metadata lock" and info = "rename tables t1 to t3, t2 to t1"; --source include/wait_condition.inc let $ID2= `select connection_id()`; @@ -508,7 +509,7 @@ let $ID2= `select connection_id()`; connection default; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and + where state = "Waiting for table metadata lock" and info = "insert into t2 values (1)"; --source include/wait_condition.inc --replace_result $ID2 ID2 @@ -536,7 +537,7 @@ connection ddl; connection dml; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Flushing tables" and + where state = "Waiting for table flush" and info = "flush tables"; --source include/wait_condition.inc --send select * from t1 @@ -544,7 +545,7 @@ let $wait_condition= connection default; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and + where state = "Waiting for table flush" and info = "select * from t1"; --source include/wait_condition.inc --replace_result $ID2 ID2 diff --git a/mysql-test/t/lock_multi.test b/mysql-test/t/lock_multi.test index 6983947d1c4..6bdb235903d 100644 --- a/mysql-test/t/lock_multi.test +++ b/mysql-test/t/lock_multi.test @@ -32,7 +32,8 @@ connection reader; # Sleep a bit till the update of connection writer is in work and hangs let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Table lock" and info = "update low_priority t1 set n = 4"; + where state = "Waiting for table level lock" and + info = "update low_priority t1 set n = 4"; --source include/wait_condition.inc send select n from t1; @@ -40,7 +41,8 @@ connection locker2; # Sleep a bit till the select of connection reader is in work and hangs let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Table lock" and info = "select n from t1"; + where state = "Waiting for table level lock" and + info = "select n from t1"; --source include/wait_condition.inc select release_lock("mysqltest_lock"); connection locker; @@ -72,7 +74,8 @@ connection reader; # Sleep a bit till the update of connection writer is in work and hangs let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Table lock" and info = "update low_priority t1 set n = 4"; + where state = "Waiting for table level lock" and + info = "update low_priority t1 set n = 4"; --source include/wait_condition.inc select n from t1; connection locker2; @@ -120,7 +123,8 @@ insert t1 select * from t2; connection locker; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "insert t1 select * from t2"; + where state = "Waiting for table metadata lock" and + info = "insert t1 select * from t2"; --source include/wait_condition.inc drop table t2; unlock tables; @@ -145,7 +149,8 @@ connection locker; # Sleep a bit till the insert of connection reader is in work and hangs let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "insert t1 select * from t2"; + where state = "Waiting for table metadata lock" and + info = "insert t1 select * from t2"; --source include/wait_condition.inc drop table t2; unlock tables; @@ -191,7 +196,7 @@ connection locker; # Sleep a bit till the select of connection reader is in work and hangs let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist - WHERE state = "Waiting for table" AND info = + WHERE state = "Waiting for table metadata lock" AND info = "SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1"; --source include/wait_condition.inc # Make test case independent from earlier grants. @@ -223,7 +228,8 @@ connection writer; # Sleep a bit till the flush of connection locker is in work and hangs let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "FLUSH TABLES WITH READ LOCK"; + where state = "Waiting for global metadata lock" and + info = "FLUSH TABLES WITH READ LOCK"; --source include/wait_condition.inc # This must not block. --error ER_TABLE_NOT_LOCKED @@ -254,7 +260,8 @@ connection writer; # Sleep a bit till the flush of connection locker is in work and hangs let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "FLUSH TABLES WITH READ LOCK"; + where state = "Waiting for global metadata lock" and + info = "FLUSH TABLES WITH READ LOCK"; --source include/wait_condition.inc --error ER_TABLE_NOT_LOCKED CREATE TABLE t2 AS SELECT * FROM t1; @@ -326,7 +333,8 @@ connection reader; # Wait till connection writer is blocked let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "alter table t1 auto_increment=0"; + where state = "Waiting for table metadata lock" and + info = "alter table t1 auto_increment=0"; --source include/wait_condition.inc send alter table t1 auto_increment=0; @@ -334,7 +342,8 @@ connection locker; # Wait till connection reader is blocked let $wait_condition= select count(*) = 2 from information_schema.processlist - where state = "Waiting for table" and info = "alter table t1 auto_increment=0"; + where state = "Waiting for table metadata lock" and + info = "alter table t1 auto_increment=0"; --source include/wait_condition.inc unlock tables; connection writer; @@ -367,7 +376,8 @@ connection con5; --echo # con5 let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "flush tables with read lock"; + where state = "Waiting for global metadata lock" and + info = "flush tables with read lock"; --source include/wait_condition.inc --echo # global read lock is taken connection con3; @@ -489,16 +499,20 @@ update t1 set i= 10; connection reader; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Table lock" and info = "update t1 set i= 10"; + where state = "Waiting for table level lock" and + info = "update t1 set i= 10"; --source include/wait_condition.inc send select * from t1; connection default; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Table lock" and info = "select * from t1"; + where state = "Waiting for table level lock" and + info = "select * from t1"; --source include/wait_condition.inc -let $ID= `select id from information_schema.processlist where state = "Table lock" and info = "update t1 set i= 10"`; +let $ID= `select id from information_schema.processlist + where state = "Waiting for table level lock" and + info = "update t1 set i= 10"`; --replace_result $ID ID eval kill query $ID; connection reader; @@ -557,7 +571,7 @@ connection default; --echo connection: default let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table"; + where state = "Waiting for global metadata lock"; --source include/wait_condition.inc alter table t1 add column j int; connect (insert,localhost,root,,test,,); @@ -565,7 +579,7 @@ connection insert; --echo connection: insert let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table"; + where state = "Waiting for global metadata lock"; --source include/wait_condition.inc --send insert into t1 values (1,2); --echo connection: default @@ -615,12 +629,12 @@ connection default; --echo connection: default let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table"; + where state = "Waiting for global metadata lock"; --source include/wait_condition.inc flush tables; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table"; + where state = "Waiting for global metadata lock"; --source include/wait_condition.inc unlock tables; connection flush; @@ -646,7 +660,8 @@ send insert into t1 values(1); connection default; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Table lock" and info = "insert into t1 values(1)"; + where state = "Waiting for table level lock" and + info = "insert into t1 values(1)"; --source include/wait_condition.inc let $tlwb= `show status like 'Table_locks_waited'`; unlock tables; @@ -683,12 +698,12 @@ connection default; --echo connection: default let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table"; + where state = "Waiting for global metadata lock"; --source include/wait_condition.inc flush tables; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table"; + where state = "Waiting for global metadata lock"; --source include/wait_condition.inc drop table t1; connection flush; @@ -725,7 +740,8 @@ connection default; --echo # connection holds SW metadata lock on table to be altered. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "alter table t1 add column c4 int"; + where state = "Waiting for table metadata lock" and + info = "alter table t1 add column c4 int"; --source include/wait_condition.inc --echo # The below statement should succeed. It should not @@ -825,7 +841,8 @@ connection default; --echo # Wait until ALTER TABLE gets blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "alter table t1 add column j int"; + where state = "Waiting for table metadata lock" and + info = "alter table t1 add column j int"; --source include/wait_condition.inc --echo # The below statement should try to acquire SW lock on 't1' --echo # and therefore should get ER_LOCK_DEADLOCK error. Before @@ -855,7 +872,8 @@ connection default; --echo # Wait until ALTER TABLE gets blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "alter table t1 drop column j"; + where state = "Waiting for table metadata lock" and + info = "alter table t1 drop column j"; --source include/wait_condition.inc --echo # The below statement should try to acquire SW lock on 't1' --echo # and therefore should get ER_LOCK_DEADLOCK error. Before @@ -982,7 +1000,7 @@ connection con3; connection con2; let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist - WHERE state = "Flushing tables" AND info = "FLUSH TABLES"; + WHERE state = "Waiting for table flush" AND info = "FLUSH TABLES"; --source include/wait_condition.inc --error ER_LOCK_WAIT_TIMEOUT SELECT * FROM t1; @@ -1014,7 +1032,8 @@ connection con3; connection con2; let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist - WHERE state = "Waiting for table" AND info = "DROP TABLE t1, t2"; + WHERE state = "Waiting for table metadata lock" AND + info = "DROP TABLE t1, t2"; --source include/wait_condition.inc # Note: This query causes two timeouts. # 1: try_acquire_high_prio_shared_mdl_lock on t1 @@ -1069,7 +1088,8 @@ connection default; --echo # Wait until RENAME TABLE is blocked on table 't3'. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "rename tables t1 to t2, t2 to t3"; + where state = "Waiting for table metadata lock" and + info = "rename tables t1 to t2, t2 to t3"; --source include/wait_condition.inc --echo # Kill RENAME TABLE. --replace_result $ID ID diff --git a/mysql-test/t/lock_sync.test b/mysql-test/t/lock_sync.test index 2f35da9d1ee..49f8f59ec5a 100644 --- a/mysql-test/t/lock_sync.test +++ b/mysql-test/t/lock_sync.test @@ -898,7 +898,7 @@ set debug_sync= 'now WAIT_FOR parked'; connection default; --echo # Wait until this LOCK TABLES statement starts waiting for table lock. let $wait_condition= select count(*)= 1 from information_schema.processlist - where state= 'Table lock' and + where state= 'Waiting for table level lock' and info='lock table v1 write'; --source include/wait_condition.inc --echo # Allow SELECT ... FOR UPDATE to resume. @@ -972,7 +972,7 @@ connection default; connection con2; let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist - WHERE state = "Waiting for table" + WHERE state = "Waiting for table metadata lock" AND info = "ALTER TABLE t1 ADD COLUMN j INT"; --source include/wait_condition.inc diff --git a/mysql-test/t/mdl_sync.test b/mysql-test/t/mdl_sync.test index 6b721ace07f..55c04d7870b 100644 --- a/mysql-test/t/mdl_sync.test +++ b/mysql-test/t/mdl_sync.test @@ -128,7 +128,8 @@ connection mdl_con2; --echo # Check that the above RENAME is blocked because of S lock. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "rename table t1 to t2"; + where state = "Waiting for table metadata lock" and + info = "rename table t1 to t2"; --source include/wait_condition.inc --echo # --echo # Switching to connection 'default'. @@ -158,7 +159,8 @@ connection mdl_con2; --echo # Check that the above ALTER TABLE is blocked because of S lock. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "alter table t1 add column c2 int"; + where state = "Waiting for table metadata lock" and + info = "alter table t1 add column c2 int"; --source include/wait_condition.inc --echo # --echo # Switching to connection 'default'. @@ -190,7 +192,8 @@ connection mdl_con2; --echo # because of S lock. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "alter table t1 add column c2 int"; + where state = "Waiting for table metadata lock" and + info = "alter table t1 add column c2 int"; --source include/wait_condition.inc --echo # --echo # Switching to connection 'default'. @@ -245,7 +248,8 @@ connection mdl_con2; --echo # Check that the above RENAME is blocked because of SH lock. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "rename table t1 to t2"; + where state = "Waiting for table metadata lock" and + info = "rename table t1 to t2"; --source include/wait_condition.inc --echo # Unblock RENAME TABLE. set debug_sync= 'now SIGNAL finish'; @@ -280,7 +284,8 @@ connection mdl_con2; --echo # Check that the above ALTER TABLE is blocked because of SH lock. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "alter table t1 add column c2 int"; + where state = "Waiting for table metadata lock" and + info = "alter table t1 add column c2 int"; --source include/wait_condition.inc --echo # Unblock RENAME TABLE. set debug_sync= 'now SIGNAL finish'; @@ -316,7 +321,8 @@ connection mdl_con2; --echo # because of S lock. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "alter table t1 add column c2 int"; + where state = "Waiting for table metadata lock" and + info = "alter table t1 add column c2 int"; --source include/wait_condition.inc --echo # Unblock RENAME TABLE. set debug_sync= 'now SIGNAL finish'; @@ -367,7 +373,8 @@ connection default; --echo # Check that the above LOCK TABLES is blocked because of SR lock. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "lock table t1 write"; + where state = "Waiting for table metadata lock" and + info = "lock table t1 write"; --source include/wait_condition.inc --echo # Unblock LOCK TABLES. commit; @@ -395,7 +402,8 @@ connection mdl_con2; --echo # Check that the above RENAME is blocked because of SR lock. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "rename table t1 to t2"; + where state = "Waiting for table metadata lock" and + info = "rename table t1 to t2"; --source include/wait_condition.inc --echo # --echo # Switching to connection 'default'. @@ -426,7 +434,8 @@ connection mdl_con2; --echo # Check that the above ALTER TABLE is blocked because of SR lock. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "alter table t1 add column c2 int"; + where state = "Waiting for table metadata lock" and + info = "alter table t1 add column c2 int"; --source include/wait_condition.inc --echo # --echo # Switching to connection 'default'. @@ -479,7 +488,8 @@ connection default; --echo # Check that the above ALTER TABLE is blocked because of SW lock. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "alter table t1 add primary key (c1)"; + where state = "Waiting for table metadata lock" and + info = "alter table t1 add primary key (c1)"; --source include/wait_condition.inc --echo # Unblock ALTER TABLE. commit; @@ -506,7 +516,8 @@ connection default; --echo # Check that the above LOCK TABLES is blocked because of SW lock. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "lock table t1 write"; + where state = "Waiting for table metadata lock" and + info = "lock table t1 write"; --source include/wait_condition.inc --echo # Unblock LOCK TABLES. commit; @@ -534,7 +545,8 @@ connection mdl_con2; --echo # Check that the above RENAME is blocked because of SW lock. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "rename table t1 to t2"; + where state = "Waiting for table metadata lock" and + info = "rename table t1 to t2"; --source include/wait_condition.inc --echo # --echo # Switching to connection 'default'. @@ -583,7 +595,8 @@ connection mdl_con2; --echo # Check that the above DELETE is blocked because of SNW lock. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "delete from t1 limit 2"; + where state = "Waiting for table metadata lock" and + info = "delete from t1 limit 2"; --source include/wait_condition.inc --echo # Unblock ALTER and thus DELETE. set debug_sync= 'now SIGNAL finish'; @@ -617,7 +630,8 @@ connection mdl_con2; --echo # Check that the above ALTER is blocked because of SNW lock. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "alter table t1 add primary key (c1)"; + where state = "Waiting for table metadata lock" and + info = "alter table t1 add primary key (c1)"; --source include/wait_condition.inc --echo # Unblock ALTERs. set debug_sync= 'now SIGNAL finish'; @@ -652,7 +666,8 @@ connection mdl_con2; --echo # Check that the above LOCK TABLES is blocked because of SNW lock. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "lock table t1 write"; + where state = "Waiting for table metadata lock" and + info = "lock table t1 write"; --source include/wait_condition.inc --echo # Unblock ALTER and thus LOCK TABLES. set debug_sync= 'now SIGNAL finish'; @@ -688,7 +703,8 @@ connection mdl_con2; --echo # Check that the above RENAME is blocked because of SNW lock. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "rename table t1 to t2"; + where state = "Waiting for table metadata lock" and + info = "rename table t1 to t2"; --source include/wait_condition.inc --echo # Unblock ALTER and thus RENAME TABLE. set debug_sync= 'now SIGNAL finish'; @@ -735,7 +751,8 @@ connection default; --echo # Check that the above SELECT is blocked because of SNRW lock. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "select count(*) from t1"; + where state = "Waiting for table metadata lock" and + info = "select count(*) from t1"; --source include/wait_condition.inc --echo # Unblock SELECT. unlock tables; @@ -760,7 +777,8 @@ connection default; --echo # Check that the above DELETE is blocked because of SNRW lock. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "delete from t1 limit 1"; + where state = "Waiting for table metadata lock" and + info = "delete from t1 limit 1"; --source include/wait_condition.inc --echo # Unblock DELETE. unlock tables; @@ -785,7 +803,8 @@ connection default; --echo # Check that the above ALTER is blocked because of UNWR lock. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "alter table t1 add primary key (c1)"; + where state = "Waiting for table metadata lock" and + info = "alter table t1 add primary key (c1)"; --source include/wait_condition.inc --echo # Unblock ALTER. unlock tables; @@ -811,7 +830,8 @@ connection default; --echo # Check that the above LOCK TABLES is blocked because of SNRW lock. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "lock table t1 write"; + where state = "Waiting for table metadata lock" and + info = "lock table t1 write"; --source include/wait_condition.inc --echo # Unblock waiting LOCK TABLES. unlock tables; @@ -838,7 +858,8 @@ connection default; --echo # Check that the above RENAME is blocked because of SNRW lock. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "rename table t1 to t2"; + where state = "Waiting for table metadata lock" and + info = "rename table t1 to t2"; --source include/wait_condition.inc --echo # Unblock RENAME TABLE unlock tables; @@ -879,7 +900,8 @@ connection mdl_con1; --echo # Check that RENAME has acquired X lock on t1 and is waiting for t2. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "rename table t1 to t2"; +where state = "Waiting for table metadata lock" and + info = "rename table t1 to t2"; --source include/wait_condition.inc --echo # Check that S lock in incompatible with X lock. --echo # Sending: @@ -890,7 +912,8 @@ connection mdl_con2; --echo # Check that the above HANDLER statement is blocked because of X lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "handler t1 open"; +where state = "Waiting for table metadata lock" and + info = "handler t1 open"; --source include/wait_condition.inc --echo # Unblock RENAME TABLE unlock tables; @@ -922,7 +945,8 @@ connection mdl_con1; --echo # Check that RENAME has acquired X lock on t1 and is waiting for t2. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "rename table t1 to t2"; +where state = "Waiting for table metadata lock" and + info = "rename table t1 to t2"; --source include/wait_condition.inc --echo # Check that SH lock in incompatible with X lock. --echo # Sending: @@ -934,7 +958,8 @@ connection mdl_con2; --echo # because of X lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info like "select column_name from information_schema.columns%"; +where state = "Waiting for table metadata lock" and + info like "select column_name from information_schema.columns%"; --source include/wait_condition.inc --echo # Unblock RENAME TABLE unlock tables; @@ -965,7 +990,8 @@ connection mdl_con1; --echo # Check that RENAME has acquired X lock on t1 and is waiting for t2. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "rename table t1 to t2"; +where state = "Waiting for table metadata lock" and + info = "rename table t1 to t2"; --source include/wait_condition.inc --echo # Check that SR lock in incompatible with X lock. --echo # Sending: @@ -977,7 +1003,8 @@ connection mdl_con2; --echo # because of X lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "select count(*) from t1"; +where state = "Waiting for table metadata lock" and + info = "select count(*) from t1"; --source include/wait_condition.inc --echo # Unblock RENAME TABLE unlock tables; @@ -1008,7 +1035,8 @@ connection mdl_con1; --echo # Check that RENAME has acquired X lock on t1 and is waiting for t2. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "rename table t1 to t2"; +where state = "Waiting for table metadata lock" and + info = "rename table t1 to t2"; --source include/wait_condition.inc --echo # Check that SW lock in incompatible with X lock. --echo # Sending: @@ -1020,7 +1048,8 @@ connection mdl_con2; --echo # because of X lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "delete from t1 limit 1"; +where state = "Waiting for table metadata lock" and + info = "delete from t1 limit 1"; --source include/wait_condition.inc --echo # Unblock RENAME TABLE unlock tables; @@ -1051,7 +1080,8 @@ connection mdl_con1; --echo # Check that RENAME has acquired X lock on t1 and is waiting for t2. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "rename table t1 to t2"; +where state = "Waiting for table metadata lock" and + info = "rename table t1 to t2"; --source include/wait_condition.inc --echo # Check that SNW lock is incompatible with X lock. --echo # Sending: @@ -1063,7 +1093,8 @@ connection mdl_con2; --echo # because of X lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "alter table t1 add primary key (c1)"; +where state = "Waiting for table metadata lock" and + info = "alter table t1 add primary key (c1)"; --source include/wait_condition.inc --echo # Unblock RENAME TABLE unlock tables; @@ -1095,7 +1126,8 @@ connection mdl_con1; --echo # Check that RENAME has acquired X lock on t1 and is waiting for t2. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "rename table t1 to t2"; +where state = "Waiting for table metadata lock" and + info = "rename table t1 to t2"; --source include/wait_condition.inc --echo # Check that SNRW lock is incompatible with X lock. --echo # Sending: @@ -1107,7 +1139,8 @@ connection mdl_con2; --echo # because of X lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "lock table t1 write"; +where state = "Waiting for table metadata lock" and + info = "lock table t1 write"; --source include/wait_condition.inc --echo # Unblock RENAME TABLE unlock tables; @@ -1139,7 +1172,8 @@ connection mdl_con1; --echo # Check that RENAME has acquired X lock on t1 and is waiting for t2. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "rename table t1 to t2"; +where state = "Waiting for table metadata lock" and + info = "rename table t1 to t2"; --source include/wait_condition.inc --echo # Check that X lock is incompatible with X lock. --echo # Sending: @@ -1151,7 +1185,8 @@ connection mdl_con2; --echo # because of X lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "rename table t1 to t3"; +where state = "Waiting for table metadata lock" and + info = "rename table t1 to t3"; --source include/wait_condition.inc --echo # Unblock RENAME TABLE unlock tables; @@ -1195,7 +1230,8 @@ connection mdl_con1; --echo # Check that ALTER TABLE is waiting with pending SNW lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "alter table t1 add primary key (c1)"; +where state = "Waiting for table metadata lock" and + info = "alter table t1 add primary key (c1)"; --source include/wait_condition.inc --echo # Check that S, SH and SR locks are compatible with pending SNW handler t1 open t; @@ -1212,7 +1248,8 @@ connection mdl_con2; --echo # Check that the above DELETE is blocked because of pending SNW lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "delete from t1 limit 1"; +where state = "Waiting for table metadata lock" and + info = "delete from t1 limit 1"; --source include/wait_condition.inc --echo # Unblock ALTER TABLE. commit; @@ -1252,7 +1289,8 @@ connection mdl_con1; --echo # Check that LOCK TABLE is waiting with pending SNRW lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "lock table t1 write"; +where state = "Waiting for table metadata lock" and + info = "lock table t1 write"; --source include/wait_condition.inc --echo # Check that S and SH locks are compatible with pending SNRW handler t1 open t; @@ -1268,7 +1306,8 @@ connection mdl_con2; --echo # Check that the above SELECT is blocked because of pending SNRW lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "select count(*) from t1"; +where state = "Waiting for table metadata lock" and + info = "select count(*) from t1"; --source include/wait_condition.inc --echo # Unblock LOCK TABLE. commit; @@ -1300,7 +1339,8 @@ connection mdl_con1; --echo # Check that LOCK TABLE is waiting with pending SNRW lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "lock table t1 write"; +where state = "Waiting for table metadata lock" and + info = "lock table t1 write"; --source include/wait_condition.inc --echo # Check that SW is incompatible with pending SNRW --echo # Sending: @@ -1311,7 +1351,8 @@ connection mdl_con2; --echo # Check that the above INSERT is blocked because of pending SNRW lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "insert into t1 values (1)"; +where state = "Waiting for table metadata lock" and + info = "insert into t1 values (1)"; --source include/wait_condition.inc --echo # Unblock LOCK TABLE. commit; @@ -1343,7 +1384,8 @@ connection mdl_con1; --echo # Check that LOCK TABLE is waiting with pending SNRW lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "lock table t1 write"; +where state = "Waiting for table metadata lock" and + info = "lock table t1 write"; --source include/wait_condition.inc --echo # Check that SNW is compatible with pending SNRW --echo # So ALTER TABLE statements are not starved by LOCK TABLEs. @@ -1385,7 +1427,8 @@ connection mdl_con1; --echo # Check that RENAME TABLE is waiting with pending X lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "rename table t1 to t2"; +where state = "Waiting for table metadata lock" and + info = "rename table t1 to t2"; --source include/wait_condition.inc --echo # Check that SH locks are compatible with pending X select column_name from information_schema.columns where @@ -1399,7 +1442,8 @@ connection mdl_con2; --echo # Check that the above HANDLER OPEN is blocked because of pending X lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "handler t1 open"; +where state = "Waiting for table metadata lock" and + info = "handler t1 open"; --source include/wait_condition.inc --echo # Unblock RENAME TABLE. commit; @@ -1433,7 +1477,8 @@ connection mdl_con1; --echo # Check that RENAME TABLE is waiting with pending X lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "rename table t1 to t2"; +where state = "Waiting for table metadata lock" and + info = "rename table t1 to t2"; --source include/wait_condition.inc --echo # Check that SR is incompatible with pending X --echo # Sending: @@ -1444,7 +1489,8 @@ connection mdl_con2; --echo # Check that the above SELECT is blocked because of pending X lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "select count(*) from t1"; +where state = "Waiting for table metadata lock" and + info = "select count(*) from t1"; --source include/wait_condition.inc --echo # Unblock RENAME TABLE. commit; @@ -1477,7 +1523,8 @@ connection mdl_con1; --echo # Check that RENAME TABLE is waiting with pending X lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "rename table t1 to t2"; +where state = "Waiting for table metadata lock" and + info = "rename table t1 to t2"; --source include/wait_condition.inc --echo # Check that SW is incompatible with pending X --echo # Sending: @@ -1488,7 +1535,8 @@ connection mdl_con2; --echo # Check that the above DELETE is blocked because of pending X lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "delete from t1 limit 1"; +where state = "Waiting for table metadata lock" and + info = "delete from t1 limit 1"; --source include/wait_condition.inc --echo # Unblock RENAME TABLE. commit; @@ -1521,7 +1569,8 @@ connection mdl_con1; --echo # Check that RENAME TABLE is waiting with pending X lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "rename table t1 to t2"; +where state = "Waiting for table metadata lock" and + info = "rename table t1 to t2"; --source include/wait_condition.inc --echo # Check that SNW is incompatible with pending X --echo # Sending: @@ -1532,7 +1581,8 @@ connection mdl_con2; --echo # Check that the above ALTER TABLE is blocked because of pending X lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "alter table t1 add primary key (c1)"; +where state = "Waiting for table metadata lock" and + info = "alter table t1 add primary key (c1)"; --source include/wait_condition.inc --echo # Unblock RENAME TABLE. commit; @@ -1565,7 +1615,8 @@ connection mdl_con1; --echo # Check that RENAME TABLE is waiting with pending X lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "rename table t1 to t2"; +where state = "Waiting for table metadata lock" and + info = "rename table t1 to t2"; --source include/wait_condition.inc --echo # Check that SNRW is incompatible with pending X --echo # Sending: @@ -1576,7 +1627,8 @@ connection mdl_con3; --echo # Check that the above LOCK TABLES is blocked because of pending X lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "lock table t1 write"; +where state = "Waiting for table metadata lock" and + info = "lock table t1 write"; --source include/wait_condition.inc --echo # --echo # Switching to connection 'mdl_con2'. @@ -1642,7 +1694,8 @@ connection mdl_con2; --echo # Check that the above INSERT is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "insert into t2 values (1)"; +where state = "Waiting for table metadata lock" and + info = "insert into t2 values (1)"; --source include/wait_condition.inc --echo # Unblock ALTER TABLE and thus INSERT. set debug_sync= 'now SIGNAL finish'; @@ -1691,7 +1744,8 @@ connection mdl_con2; --echo # Check that the above INSERT is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "insert into t1 values (1)"; +where state = "Waiting for table metadata lock" and + info = "insert into t1 values (1)"; --source include/wait_condition.inc --echo # Unblock ALTER TABLE and thus INSERT. set debug_sync= 'now SIGNAL finish'; @@ -1726,7 +1780,8 @@ connection default; --echo # Wait until ALTER TABLE starts waiting for SNW lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "alter table t1 add primary key (c1)"; +where state = "Waiting for table metadata lock" and + info = "alter table t1 add primary key (c1)"; --source include/wait_condition.inc --echo # We should still be able to get both SW and SR locks without waiting. select count(*) from t1; @@ -1769,7 +1824,8 @@ connection default; --echo # Wait until ALTER TABLE starts waiting X lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "alter table t2 add column c2 int"; +where state = "Waiting for table metadata lock" and + info = "alter table t2 add column c2 int"; --source include/wait_condition.inc --echo # Check that attempt to acquire SR lock on t2 causes waiting. --echo # Sending: @@ -1780,7 +1836,8 @@ connection mdl_con2; --echo # Check that the above SELECT is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "select count(*) from t2"; +where state = "Waiting for table metadata lock" and + info = "select count(*) from t2"; --source include/wait_condition.inc --echo # Unblock ALTER TABLE. commit; @@ -1817,7 +1874,8 @@ connection default; --echo # Wait until ALTER TABLE starts waiting X lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "alter table t2 drop column c2"; +where state = "Waiting for table metadata lock" and + info = "alter table t2 drop column c2"; --source include/wait_condition.inc --echo # Check that attempt to acquire SW lock on t2 causes waiting. --echo # Sending: @@ -1828,7 +1886,8 @@ connection mdl_con2; --echo # Check that the above INSERT is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "insert into t2 values (1)"; +where state = "Waiting for table metadata lock" and + info = "insert into t2 values (1)"; --source include/wait_condition.inc --echo # Unblock ALTER TABLE. commit; @@ -1861,7 +1920,8 @@ connection default; --echo # Wait until ALTER TABLE starts waiting X lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "alter table t1 add column c2 int"; +where state = "Waiting for table metadata lock" and + info = "alter table t1 add column c2 int"; --source include/wait_condition.inc --echo # Check that transaction is still able to acquire SR lock. select count(*) from t1; @@ -1904,7 +1964,8 @@ connection mdl_con1; --echo # Check that the above SELECT is blocked let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "select count(*) from t2"; +where state = "Waiting for table metadata lock" and + info = "select count(*) from t2"; --source include/wait_condition.inc --echo # Unblock SELECT. unlock tables; @@ -1934,7 +1995,8 @@ connection mdl_con1; --echo # Check that the above DELETE is blocked let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "delete from t2 limit 1"; +where state = "Waiting for table metadata lock" and + info = "delete from t2 limit 1"; --source include/wait_condition.inc --echo # Unblock DELETE. unlock tables; @@ -1964,7 +2026,8 @@ connection default; --echo # Wait until LOCK TABLE is blocked creating pending request for X lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "lock table t1 write"; +where state = "Waiting for table metadata lock" and + info = "lock table t1 write"; --source include/wait_condition.inc --echo # Check that another instance of SR lock is granted without waiting. select count(*) from t1; @@ -1999,7 +2062,8 @@ connection default; --echo # Wait until LOCK TABLE is blocked creating pending request for X lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "lock table t1 write"; +where state = "Waiting for table metadata lock" and + info = "lock table t1 write"; --source include/wait_condition.inc --echo # Check that both SR and SW locks are granted without waiting --echo # and errors. @@ -2043,7 +2107,8 @@ connection default; --echo # Wait until RENAME TABLE starts waiting with pending X lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "rename table t2 to t3"; +where state = "Waiting for table metadata lock" and + info = "rename table t2 to t3"; --source include/wait_condition.inc --echo # Check that attempt to acquire SR lock on t2 causes waiting. --echo # Sending: @@ -2054,7 +2119,8 @@ connection mdl_con2; --echo # Check that the above SELECT is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "select count(*) from t2"; +where state = "Waiting for table metadata lock" and + info = "select count(*) from t2"; --source include/wait_condition.inc --echo # Unblock RENAME TABLE. commit; @@ -2093,7 +2159,8 @@ connection default; --echo # Wait until RENAME TABLE starts waiting with pending X lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "rename table t2 to t3"; +where state = "Waiting for table metadata lock" and + info = "rename table t2 to t3"; --source include/wait_condition.inc --echo # Check that attempt to acquire SW lock on t2 causes waiting. --echo # Sending: @@ -2104,7 +2171,8 @@ connection mdl_con2; --echo # Check that the above DELETE is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "delete from t2 limit 1"; +where state = "Waiting for table metadata lock" and + info = "delete from t2 limit 1"; --source include/wait_condition.inc --echo # Unblock RENAME TABLE. commit; @@ -2141,7 +2209,8 @@ connection default; --echo # Wait until RENAME TABLE is blocked creating pending request for X lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "rename table t1 to t2"; +where state = "Waiting for table metadata lock" and + info = "rename table t1 to t2"; --source include/wait_condition.inc --echo # Check that another instance of SR lock is granted without waiting. select count(*) from t1; @@ -2176,7 +2245,8 @@ connection default; --echo # Wait until RENAME TABLE is blocked creating pending request for X lock. let $wait_condition= select count(*) = 1 from information_schema.processlist -where state = "Waiting for table" and info = "rename table t1 to t2"; +where state = "Waiting for table metadata lock" and + info = "rename table t1 to t2"; --source include/wait_condition.inc --echo # Check that both SR and SW locks are granted without waiting --echo # and errors. @@ -2236,7 +2306,8 @@ connection handler_con2; --echo # Wait until ALTER is blocked during upgrade. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "alter table t1 add column j int"; + where state = "Waiting for table metadata lock" and + info = "alter table t1 add column j int"; --source include/wait_condition.inc --echo # --echo # Switching to connection 'default'. @@ -2279,7 +2350,8 @@ connection handler_con1; --echo # Wait until INSERT is blocked on table-level lock. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Table lock" and info = "insert into t2 values (1)"; + where state = "Waiting for table level lock" and + info = "insert into t2 values (1)"; --source include/wait_condition.inc --echo # Sending 'alter table t1 drop column j'. It should not cause --echo # deadlock. @@ -2289,7 +2361,8 @@ connection handler_con2; --echo # Wait until ALTER is blocked during upgrade. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "alter table t1 drop column j"; + where state = "Waiting for table metadata lock" and + info = "alter table t1 drop column j"; --source include/wait_condition.inc --echo # --echo # Switching to connection 'default'. @@ -2328,7 +2401,8 @@ connection handler_con1; --echo # Wait until INSERT is blocked because of SNRW lock. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "insert into t1 values (1)"; + where state = "Waiting for table metadata lock" and + info = "insert into t1 values (1)"; --source include/wait_condition.inc --echo # The below ALTER TABLE will be blocked because of presence of HANDLER. --echo # Sending: @@ -2374,7 +2448,8 @@ connection handler_con1; --echo # Wait until INSERT is blocked because of SNRW lock. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "insert into t2 values (1)"; + where state = "Waiting for table metadata lock" and + info = "insert into t2 values (1)"; --source include/wait_condition.inc --echo # The below ALTER TABLE will be blocked because of presence of HANDLER. --echo # Sending: @@ -2451,7 +2526,8 @@ connection deadlock_con1; --echo # for 'deadlock_con2' which holds shared metadata lock on 't2'. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "rename table t2 to t0, t3 to t2, t0 to t3"; + where state = "Waiting for table metadata lock" and + info = "rename table t2 to t0, t3 to t2, t0 to t3"; --source include/wait_condition.inc --echo # The below statement should wait for exclusive metadata lock --echo # on 't2' to go away and should not produce ER_LOCK_DEADLOCK @@ -2466,7 +2542,8 @@ connection deadlock_con2; --echo # for an exclusive metadata lock to go away. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "select * from t2"; + where state = "Waiting for table metadata lock" and + info = "select * from t2"; --source include/wait_condition.inc --echo # --echo # Unblock RENAME TABLE by releasing shared metadata lock on t2. @@ -2502,7 +2579,8 @@ connection deadlock_con1; --echo # table 't1'. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "rename table t1 to t0, t3 to t1, t0 to t3"; + where state = "Waiting for table metadata lock" and + info = "rename table t1 to t0, t3 to t1, t0 to t3"; --source include/wait_condition.inc --echo # Commit transaction to unblock RENAME TABLE. commit; @@ -2536,7 +2614,8 @@ connection deadlock_con1; --echo # for 'deadlock_con1' which holds shared metadata lock on 't2'. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "rename table t2 to t0, t1 to t2, t0 to t1"; + where state = "Waiting for table metadata lock" and + info = "rename table t2 to t0, t1 to t2, t0 to t1"; --source include/wait_condition.inc --echo # --echo # The below statement should not wait as doing so will cause deadlock. @@ -2549,7 +2628,8 @@ select * from t1; --echo # metadata lock on table 't1', i.e. that RENAME TABLE is still blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "rename table t2 to t0, t1 to t2, t0 to t1"; + where state = "Waiting for table metadata lock" and + info = "rename table t2 to t0, t1 to t2, t0 to t1"; --source include/wait_condition.inc --echo # Commit transaction to unblock RENAME TABLE. commit; @@ -2590,7 +2670,7 @@ connection deadlock_con2; --echo # for an UNRW metadata lock to go away. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "select * from t1"; + where state = "Waiting for table metadata lock" and info = "select * from t1"; --source include/wait_condition.inc --echo # Send RENAME TABLE statement that will deadlock with the @@ -2604,7 +2684,8 @@ connection default; --echo # pending X lock on t1. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "rename table t1 to t0, t2 to t1, t0 to t2"; + where state = "Waiting for table metadata lock" and + info = "rename table t1 to t0, t2 to t1, t0 to t2"; --source include/wait_condition.inc --echo # Allow the above RENAME TABLE to acquire lock on t1 and --echo # create pending lock on t2 thus creating deadlock. @@ -2626,7 +2707,8 @@ connection deadlock_con1; --echo # is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "rename table t1 to t0, t2 to t1, t0 to t2"; + where state = "Waiting for table metadata lock" and + info = "rename table t1 to t0, t2 to t1, t0 to t2"; --source include/wait_condition.inc --echo # Commit transaction to unblock this RENAME TABLE. commit; @@ -2674,7 +2756,8 @@ connection deadlock_con1; --echo # 'deadlock_con1' which holds shared lock on 't1'. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "alter table t1 add column j int, rename to t2"; + where state = "Waiting for table metadata lock" and + info = "alter table t1 add column j int, rename to t2"; --source include/wait_condition.inc --echo # The below statement should not wait as it will cause deadlock. @@ -2687,7 +2770,8 @@ select * from t2; --echo # so ALTER TABLE ... RENAME is still blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "alter table t1 add column j int, rename to t2"; + where state = "Waiting for table metadata lock" and + info = "alter table t1 add column j int, rename to t2"; --source include/wait_condition.inc --echo # Commit transaction to unblock ALTER TABLE ... RENAME. @@ -2732,7 +2816,8 @@ connection deadlock_con2; --echo # while trying to acquire SNRW lock on 't1'. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "lock tables t1 write, t2 write"; + where state = "Waiting for table metadata lock" and + info = "lock tables t1 write, t2 write"; --source include/wait_condition.inc --echo # Resume SELECT execution, this should eventually unblock LOCK TABLES. set debug_sync= 'now SIGNAL finish'; @@ -2801,7 +2886,8 @@ connection deadlock_con2; --echo # Wait until ALTER is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "alter table t1 drop column j"; + where state = "Waiting for table metadata lock" and + info = "alter table t1 drop column j"; --source include/wait_condition.inc --echo # Resume INSERT so it can start deadlock detection. --echo # @@ -2829,6 +2915,188 @@ connection default; drop table t1; +--echo # +--echo # Now, test for a situation in which deadlock involves waiting not +--echo # only in MDL subsystem but also for TDC. Such deadlocks should be +--echo # successfully detected. If possible, they should be resolved without +--echo # resorting to ER_LOCK_DEADLOCK error. +--echo # +create table t1(i int); +create table t2(j int); + +--echo # +--echo # First, let us check how we handle a simple scenario involving +--echo # waits in MDL and TDC. +--echo # +set debug_sync= 'RESET'; + +--echo # Switching to connection 'deadlock_con1'. +connection deadlock_con1; +--echo # Start a statement, which will acquire SR metadata lock on t1, open it +--echo # and then stop, before trying to acquire SW lock on t2 and opening it. +set debug_sync='open_tables_after_open_and_process_table SIGNAL parked WAIT_FOR go'; +--echo # Sending: +--send select * from t1 where i in (select j from t2 for update) + +--echo # Switching to connection 'deadlock_con2'. +connection deadlock_con2; +--echo # Wait till the above SELECT stops. +set debug_sync='now WAIT_FOR parked'; +--echo # The below FLUSH TABLES WITH READ LOCK should acquire +--echo # SNW locks on t1 and t2 and wait till SELECT closes t1. +--echo # Sending: +send flush tables t1, t2 with read lock; + +--echo # Switching to connection 'deadlock_con3'. +connection deadlock_con3; +--echo # Wait until FLUSH TABLES WITH t1, t2 READ LOCK starts waiting +--echo # for SELECT to close t1. +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table flush" and + info = "flush tables t1, t2 with read lock"; +--source include/wait_condition.inc + +--echo # Resume SELECT, so it tries to acquire SW lock on t1 and blocks, +--echo # creating a deadlock. This deadlock should be detected and resolved +--echo # by backing-off SELECT. As a result FTWRL should be able to finish. +set debug_sync='now SIGNAL go'; + +--echo # Switching to connection 'deadlock_con2'. +connection deadlock_con2; +--echo # Reap FLUSH TABLES WITH READ LOCK. +reap; +unlock tables; + +--echo # Switching to connection 'deadlock_con1'. +connection deadlock_con1; +--echo # Reap SELECT. +reap; + +--echo # +--echo # The same scenario with a slightly different order of events +--echo # which emphasizes that setting correct deadlock detector weights +--echo # for flush waits is important. +--echo # +set debug_sync= 'RESET'; + +--echo # Switching to connection 'deadlock_con2'. +connection deadlock_con2; +set debug_sync='flush_tables_with_read_lock_after_acquire_locks SIGNAL parked WAIT_FOR go'; + +--echo # The below FLUSH TABLES WITH READ LOCK should acquire +--echo # SNW locks on t1 and t2 and wait on debug sync point. +--echo # Sending: +send flush tables t1, t2 with read lock; + +--echo # Switching to connection 'deadlock_con1'. +connection deadlock_con1; +--echo # Wait till FLUSH TABLE WITH READ LOCK stops. +set debug_sync='now WAIT_FOR parked'; + +--echo # Start statement which will acquire SR metadata lock on t1, open +--echo # it and then will block while trying to acquire SW lock on t2. +--echo # Sending: +send select * from t1 where i in (select j from t2 for update); + +--echo # Switching to connection 'deadlock_con3'. +connection deadlock_con3; +--echo # Wait till the above SELECT blocks. +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "select * from t1 where i in (select j from t2 for update)"; +--source include/wait_condition.inc + +--echo # Resume FLUSH TABLES, so it tries to flush t1, thus creating +--echo # a deadlock. This deadlock should be detected and resolved by +--echo # backing-off SELECT. As a result FTWRL should be able to finish. +set debug_sync='now SIGNAL go'; + +--echo # Switching to connection 'deadlock_con2'. +connection deadlock_con2; +--echo # Reap FLUSH TABLES WITH READ LOCK. +reap; +unlock tables; + +--echo # Switching to connection 'deadlock_con1'. +connection deadlock_con1; +--echo # Reap SELECT. +reap; + +--echo # +--echo # Now a more complex scenario involving two connections +--echo # waiting for MDL and one for TDC. +--echo # +set debug_sync= 'RESET'; + +--echo # Switching to connection 'deadlock_con1'. +connection deadlock_con1; +--echo # Start a statement which will acquire SR metadata lock on t2, open it +--echo # and then stop, before trying to acquire SR on t1 and opening it. +set debug_sync='open_tables_after_open_and_process_table SIGNAL parked WAIT_FOR go'; +--echo # Sending: +send select * from t2, t1; + +--echo # Switching to connection 'deadlock_con2'. +connection deadlock_con2; +--echo # Wait till the above SELECT stops. +set debug_sync='now WAIT_FOR parked'; +--echo # The below FLUSH TABLES WITH READ LOCK should acquire +--echo # SNW locks on t2 and wait till SELECT closes t2. +--echo # Sending: +send flush tables t2 with read lock; + +--echo # Switching to connection 'deadlock_con3'. +connection deadlock_con3; +--echo # Wait until FLUSH TABLES WITH READ LOCK starts waiting +--echo # for SELECT to close t2. +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table flush" and + info = "flush tables t2 with read lock"; +--source include/wait_condition.inc + +--echo # The below DROP TABLES should acquire X lock on t1 and start +--echo # waiting for X lock on t2. +--echo # Sending: +send drop tables t1, t2; + +--echo # Switching to connection 'default'. +connection default; +--echo # Wait until DROP TABLES starts waiting for X lock on t2. +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "drop tables t1, t2"; +--source include/wait_condition.inc + +--echo # Resume SELECT, so it tries to acquire SR lock on t1 and blocks, +--echo # creating a deadlock. This deadlock should be detected and resolved +--echo # by backing-off SELECT. As a result, FTWRL should be able to finish. +set debug_sync='now SIGNAL go'; + +--echo # Switching to connection 'deadlock_con2'. +connection deadlock_con2; +--echo # Reap FLUSH TABLES WITH READ LOCK. +reap; +--echo # Unblock DROP TABLES. +unlock tables; + +--echo # Switching to connection 'deadlock_con3'. +connection deadlock_con3; +--echo # Reap DROP TABLES. +reap; + +--echo # Switching to connection 'deadlock_con1'. +connection deadlock_con1; +--echo # Reap SELECT. It should emit error about missing table. +--error ER_NO_SUCH_TABLE +reap; + +--echo # Switching to connection 'default'. +connection default; + set debug_sync= 'RESET'; disconnect deadlock_con1; @@ -2837,6 +3105,75 @@ disconnect deadlock_con3; --echo # +--echo # Test for a scenario in which FLUSH TABLES <list> WITH READ LOCK +--echo # used to erroneously release metadata locks. +--echo # +connect(con1,localhost,root,,); +connect(con2,localhost,root,,); +connection default; +--disable_warnings +drop tables if exists t1, t2; +--enable_warnings +set debug_sync= 'RESET'; +create table t1(i int); +create table t2(j int); + +--echo # Switching to connection 'con2'. +connection con2; +set debug_sync='open_tables_after_open_and_process_table SIGNAL parked WAIT_FOR go'; + +--echo # The below FLUSH TABLES <list> WITH READ LOCK should acquire +--echo # SNW locks on t1 and t2, open table t1 and block on the debug +--echo # sync point. +--echo # Sending: +send flush tables t1, t2 with read lock; + +--echo # Switching to connection 'con1'. +connection con1; +--echo # Wait till FLUSH TABLES <list> WITH READ LOCK stops. +set debug_sync='now WAIT_FOR parked'; + +--echo # Start a statement which will flush all tables and thus +--echo # invalidate table t1 open by FLUSH TABLES <list> WITH READ LOCK. +--echo # Sending: +send flush tables; + +--echo # Switching to connection 'default'. +connection default; +--echo # Wait till the above FLUSH TABLES blocks. +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table flush" and + info = "flush tables"; +--source include/wait_condition.inc + +--echo # Resume FLUSH TABLES <list> WITH READ LOCK, so it tries to open t2 +--echo # discovers that its t1 is obsolete and tries to reopen all tables. +--echo # Such reopen should not cause releasing of SNW metadata locks +--echo # which would result in assertion failures. +set debug_sync='now SIGNAL go'; + +--echo # Switching to connection 'con2'. +connection con2; +--echo # Reap FLUSH TABLES <list> WITH READ LOCK. +reap; +unlock tables; + +--echo # Switching to connection 'con1'. +connection con1; +--echo # Reap FLUSH TABLES. +reap; + +--echo # Clean-up. +--echo # Switching to connection 'default'. +connection default; +drop tables t1, t2; +set debug_sync= 'RESET'; +disconnect con1; +disconnect con2; + + +--echo # --echo # Test for bug #46748 "Assertion in MDL_context::wait_for_locks() --echo # on INSERT + CREATE TRIGGER". --echo # @@ -2873,7 +3210,7 @@ connection default; --echo # metadata lock on its tables and blocks due to 't4' being used by LOCK --echo # TABLES. let $wait_condition= select count(*)= 1 from information_schema.processlist - where state= 'Waiting for table' and + where state= 'Waiting for table metadata lock' and info='rename table t3 to t5, t4 to t3'; --source include/wait_condition.inc --echo # Send : @@ -2884,7 +3221,7 @@ connection con1root; --echo # Wait until INSERT statement waits due to encountering pending --echo # exclusive metadata lock on 't3'. let $wait_condition= select count(*)= 1 from information_schema.processlist - where state= 'Waiting for table' and + where state= 'Waiting for table metadata lock' and info='insert into t1 values (1)'; --source include/wait_condition.inc unlock tables; @@ -3026,7 +3363,8 @@ connection default; --echo # Waiting until CREATE TABLE ... SELECT ... is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Table lock" and info = "create table t2 select * from t1 for update"; + where state = "Waiting for table level lock" and + info = "create table t2 select * from t1 for update"; --source include/wait_condition.inc --echo # First let us check that SHOW FIELDS/DESCRIBE doesn't @@ -3079,7 +3417,8 @@ connection default; --echo # Waiting until CREATE TABLE ... SELECT ... is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Table lock" and info = "create table t2 select * from t1 for update"; + where state = "Waiting for table level lock" and + info = "create table t2 select * from t1 for update"; --source include/wait_condition.inc --echo # Let us check that SHOW FIELDS/DESCRIBE gets blocked. @@ -3091,7 +3430,8 @@ connection con46044_2; --echo # Wait until SHOW FIELDS gets blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "show fields from t2"; + where state = "Waiting for table metadata lock" and + info = "show fields from t2"; --source include/wait_condition.inc unlock tables; @@ -3121,7 +3461,8 @@ connection default; --echo # Waiting until CREATE TABLE ... SELECT ... is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Table lock" and info = "create table t2 select * from t1 for update"; + where state = "Waiting for table level lock" and + info = "create table t2 select * from t1 for update"; --source include/wait_condition.inc --echo # Check that I_S query which reads only .FRMs gets blocked. @@ -3133,7 +3474,7 @@ connection con46044_2; --echo # Wait until SELECT COLUMN_NAME FROM I_S.COLUMNS gets blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and + where state = "Waiting for table metadata lock" and info like "select column_name from information_schema.columns%"; --source include/wait_condition.inc @@ -3164,7 +3505,8 @@ connection default; --echo # Waiting until CREATE TABLE ... SELECT ... is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Table lock" and info = "create table t2 select * from t1 for update"; + where state = "Waiting for table level lock" and + info = "create table t2 select * from t1 for update"; --source include/wait_condition.inc --echo # Finally, check that I_S query which does full-blown table open @@ -3177,7 +3519,7 @@ connection con46044_2; --echo # Wait until SELECT ... FROM I_S.TABLES gets blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and + where state = "Waiting for table metadata lock" and info like "select table_name, table_type, auto_increment, table_comment from information_schema.tables%"; --source include/wait_condition.inc @@ -3240,7 +3582,8 @@ update t1 set c3=c3+1 where c2 = 3; --echo # metadata lock on table 't1', i.e. that ALTER TABLE is still blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "alter table t1 add column e int, rename to t2"; + where state = "Waiting for table metadata lock" and + info = "alter table t1 add column e int, rename to t2"; --source include/wait_condition.inc --echo # Unblock ALTER TABLE by commiting transaction and thus releasing @@ -3425,7 +3768,7 @@ connection con1; connection con3; let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist - WHERE state = "Table lock" and info = "SELECT 1"; + WHERE state = "Waiting for table level lock" and info = "SELECT 1"; --source include/wait_condition.inc # The ALTER below will try to abort the statement in connection con1, # since the latter waits on a table-level lock while having a HANDLER @@ -3495,7 +3838,8 @@ connection con50913_2; --echo # Wait until TRUNCATE TABLE is blocked on MDL lock. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "truncate table t1"; + where state = "Waiting for table metadata lock" and + info = "truncate table t1"; --source include/wait_condition.inc --echo # Unblock ALTER TABLE. set debug_sync= 'now SIGNAL go'; @@ -3568,7 +3912,8 @@ connection con3; --echo # SW lock on the table. let $wait_condition= select count(*) = 2 from information_schema.processlist - where state = "Waiting for table" and info = "insert into t1 values (1)"; + where state = "Waiting for table metadata lock" and + info = "insert into t1 values (1)"; --source include/wait_condition.inc --echo # Unblock ALTER TABLE. Since it will try to upgrade SNW to X lock --echo # deadlock with two loops in waiting graph will occur. Both loops @@ -3738,7 +4083,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked'; --echo # Connection con3 connection con3; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist - WHERE state='Waiting for table' AND info='CREATE DATABASE db1'; + WHERE state='Waiting for schema metadata lock' AND info='CREATE DATABASE db1'; --source include/wait_condition.inc # This should not block. CREATE DATABASE db2; @@ -3778,7 +4123,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked'; --echo # Connection con3 connection con3; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist - WHERE state='Waiting for table' + WHERE state='Waiting for schema metadata lock' AND info='ALTER DATABASE db1 DEFAULT CHARACTER SET utf8'; --source include/wait_condition.inc # This should not block. @@ -3813,7 +4158,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked'; --echo # Connection con3 connection con3; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist - WHERE state='Waiting for table' AND info='DROP DATABASE db1'; + WHERE state='Waiting for schema metadata lock' AND info='DROP DATABASE db1'; --source include/wait_condition.inc SET DEBUG_SYNC= 'now SIGNAL blocked'; @@ -3857,7 +4202,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked'; --echo # Connection con3 connection con3; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist - WHERE state='Waiting for table' + WHERE state='Waiting for schema metadata lock' AND info='ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME'; --source include/wait_condition.inc # This should not block. @@ -3898,7 +4243,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked'; --echo # Connection con3 connection con3; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist - WHERE state='Waiting for table' AND info='DROP DATABASE db1'; + WHERE state='Waiting for schema metadata lock' AND info='DROP DATABASE db1'; --source include/wait_condition.inc # This should not block. CREATE DATABASE db2; @@ -3934,7 +4279,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked'; --echo # Connection con3 connection con3; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist - WHERE state='Waiting for table' + WHERE state='Waiting for schema metadata lock' AND info='ALTER DATABASE db1 DEFAULT CHARACTER SET utf8'; --source include/wait_condition.inc SET DEBUG_SYNC= 'now SIGNAL blocked'; @@ -3947,7 +4292,9 @@ connection default; --echo # Connection con2 connection con2; --echo # Reaping: ALTER DATABASE db1 DEFAULT CHARACTER SET utf8 ---error 1,1 # Wrong error pending followup patch for bug#54360 +# Error 1 is from ALTER DATABASE when the database does not exist. +# Listing the error twice to prevent result diffences based on filename. +--error 1,1 --reap @@ -3973,7 +4320,8 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked'; --echo # Connection con3 connection con3; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist - WHERE state='Waiting for table' AND info='CREATE TABLE db1.t1 (a INT)'; + WHERE state='Waiting for schema metadata lock' AND + info='CREATE TABLE db1.t1 (a INT)'; --source include/wait_condition.inc SET DEBUG_SYNC= 'now SIGNAL blocked'; @@ -4011,7 +4359,8 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked'; --echo # Connection con3 connection con3; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist - WHERE state='Waiting for table' AND info='RENAME TABLE db1.t1 TO test.t1'; + WHERE state='Waiting for schema metadata lock' AND + info='RENAME TABLE db1.t1 TO test.t1'; --source include/wait_condition.inc SET DEBUG_SYNC= 'now SIGNAL blocked'; @@ -4044,7 +4393,8 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked'; --echo # Connection con3 connection con3; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist - WHERE state='Waiting for table' AND info='RENAME TABLE test.t2 TO db1.t2'; + WHERE state='Waiting for schema metadata lock' AND + info='RENAME TABLE test.t2 TO db1.t2'; --source include/wait_condition.inc SET DEBUG_SYNC= 'now SIGNAL blocked'; @@ -4056,7 +4406,9 @@ connection default; --echo # Connection con2 connection con2; --echo # Reaping: RENAME TABLE test.t2 TO db1.t2 ---error 7, 7 # Wrong error pending followup patch for bug#54360 +# Error 7 is from RENAME TABLE where the target database does not exist. +# Listing the error twice to prevent result diffences based on filename. +--error 7, 7 --reap DROP TABLE test.t2; @@ -4084,7 +4436,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked'; --echo # Connection con3 connection con3; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist - WHERE state='Waiting for table' AND info='DROP TABLE db1.t1'; + WHERE state='Waiting for schema metadata lock' AND info='DROP TABLE db1.t1'; --source include/wait_condition.inc SET DEBUG_SYNC= 'now SIGNAL blocked'; diff --git a/mysql-test/t/merge-big.test b/mysql-test/t/merge-big.test index 509c7742dac..10d36bfe2a4 100644 --- a/mysql-test/t/merge-big.test +++ b/mysql-test/t/merge-big.test @@ -51,7 +51,7 @@ connection default; #--sleep 8 #SELECT ID,STATE,INFO FROM INFORMATION_SCHEMA.PROCESSLIST; let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST - WHERE ID = $con1_id AND STATE = 'Waiting for table'; + WHERE ID = $con1_id AND STATE = 'Waiting for table metadata lock'; --source include/wait_condition.inc #SELECT NOW(); --echo # Kick INSERT out of thr_multi_lock(). @@ -61,7 +61,7 @@ FLUSH TABLES; #--sleep 8 #SELECT ID,STATE,INFO FROM INFORMATION_SCHEMA.PROCESSLIST; let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST - WHERE ID = $con1_id AND STATE = 'Waiting for table'; + WHERE ID = $con1_id AND STATE = 'Waiting for table metadata lock'; --source include/wait_condition.inc #SELECT NOW(); --echo # Unlock and close table and wait for con1 to close too. diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index 31bc8a5e881..b6ad3324d19 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -579,7 +579,7 @@ DROP TABLE tm1, t1, t2; # CREATE TABLE t1(c1 INT); CREATE TABLE t2 (c1 INT) ENGINE=MERGE UNION=(t1) INSERT_METHOD=FIRST; ---error ER_UPDATE_TABLE_USED +# After WL#5370, it just generates a warning that the table already exists CREATE TABLE IF NOT EXISTS t1 SELECT * FROM t2; DROP TABLE t1, t2; diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index 7a81ad496b4..166d36856a6 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -497,7 +497,7 @@ connection updater; # Wait till "alter table t1 ..." of session changer is in work. # = There is one session waiting. let $wait_condition= select count(*)= 1 from information_schema.processlist - where state= 'Waiting for table'; + where state= 'Waiting for table metadata lock'; --source include/wait_condition.inc send update t1, v1 set t1.b=t1.a+t1.b+v1.b where t1.a=v1.a; @@ -508,7 +508,7 @@ connection locker; # are in work. # = There are two session waiting. let $wait_condition= select count(*)= 2 from information_schema.processlist - where state= 'Waiting for table'; + where state= 'Waiting for table metadata lock'; --source include/wait_condition.inc unlock tables; diff --git a/mysql-test/t/mysql_client_test.test b/mysql-test/t/mysql_client_test.test index c8c1fba04e1..2c19671d11b 100644 --- a/mysql-test/t/mysql_client_test.test +++ b/mysql-test/t/mysql_client_test.test @@ -2,6 +2,7 @@ -- source include/not_embedded.inc SET @old_general_log= @@global.general_log; +SET @old_slow_query_log= @@global.slow_query_log; # We run with different binaries for normal and --embedded-server # @@ -24,3 +25,4 @@ echo ok; --echo SET @@global.general_log= @old_general_log; +SET @@global.slow_query_log= @old_slow_query_log; diff --git a/mysql-test/t/mysql_not_windows.test b/mysql-test/t/mysql_not_windows.test new file mode 100644 index 00000000000..66853677f7b --- /dev/null +++ b/mysql-test/t/mysql_not_windows.test @@ -0,0 +1,15 @@ +-- source include/not_windows.inc +# This test should work in embedded server after we fix mysqltest +-- source include/not_embedded.inc +# +# Testing the MySQL command line client(mysql) +# + +# +# Bug #54466 client 5.5 built from source lacks "pager" support +# +--echo Bug #54466 client 5.5 built from source lacks "pager" support +--exec $MYSQL --pager test -e "select 1 as a" + +--echo +--echo End of tests diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index e375cb7299f..3a9dae35476 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -1,6 +1,6 @@ # We are using .opt file since we need small binlog size # TODO: Need to look at making a row based version once the new row based client is completed. [jbm] --- source include/have_binlog_format_mixed_or_statement.inc +-- source include/have_binlog_format_statement.inc -- source include/have_log_bin.inc diff --git a/mysql-test/t/not_partition.test b/mysql-test/t/not_partition.test index 78ca44acf18..38b88c00ba3 100644 --- a/mysql-test/t/not_partition.test +++ b/mysql-test/t/not_partition.test @@ -27,6 +27,7 @@ ALTER TABLE t1 CHECK PARTITION ALL; ALTER TABLE t1 OPTIMIZE PARTITION ALL; ALTER TABLE t1 ANALYZE PARTITION ALL; ALTER TABLE t1 REBUILD PARTITION ALL; +ALTER TABLE t1 TRUNCATE PARTITION ALL; ALTER TABLE t1 ENGINE Memory; ALTER TABLE t1 ADD (new INT); DROP TABLE t1; diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test index 30f5894716c..3e9ac2ce2b5 100644 --- a/mysql-test/t/partition_innodb.test +++ b/mysql-test/t/partition_innodb.test @@ -9,6 +9,107 @@ drop table if exists t1, t2; let $MYSQLD_DATADIR= `SELECT @@datadir`; --echo # +--echo # Bug#54747: Deadlock between REORGANIZE PARTITION and +--echo # SELECT is not detected +--echo # + +SET @old_innodb_thread_concurrency:= @@innodb_thread_concurrency; +SET GLOBAL innodb_thread_concurrency = 1; + +CREATE TABLE t1 +(user_num BIGINT, + hours SMALLINT, + KEY user_num (user_num)) +ENGINE = InnoDB +PARTITION BY RANGE COLUMNS (hours) +(PARTITION hour_003 VALUES LESS THAN (3), + PARTITION hour_004 VALUES LESS THAN (4), + PARTITION hour_005 VALUES LESS THAN (5), + PARTITION hour_last VALUES LESS THAN (MAXVALUE)); + +INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); + +BEGIN; +SELECT COUNT(*) FROM t1; + +--echo # con1 +--connect (con1,localhost,root,,) +--echo # SEND a ALTER PARTITION which waits on the ongoing transaction. +--send +ALTER TABLE t1 +REORGANIZE PARTITION hour_003, hour_004 INTO +(PARTITION oldest VALUES LESS THAN (4)); + +--echo # Connection default wait until the ALTER is in 'waiting for table...' +--echo # state and then continue the transaction by trying a SELECT +--connection default +let $wait_condition = +SELECT COUNT(*) = 1 +FROM information_schema.processlist +WHERE INFO like 'ALTER TABLE t1%REORGANIZE PARTITION hour_003, hour_004%' +AND STATE = 'Waiting for table metadata lock'; +--source include/wait_condition.inc +SELECT COUNT(*) FROM t1; +COMMIT; + +--echo # con1, reaping ALTER. +--connection con1 +--reap + +--echo # Disconnecting con1 and switching to default. Cleaning up. +--disconnect con1 + +--connection default + +SET GLOBAL innodb_thread_concurrency = @old_innodb_thread_concurrency; +DROP TABLE t1; + + +--echo # +--echo # Bug#50418: DROP PARTITION does not interact with transactions +--echo # +CREATE TABLE t1 ( + id INT AUTO_INCREMENT NOT NULL, + name CHAR(50) NOT NULL, + myDate DATE NOT NULL, + PRIMARY KEY (id, myDate), + INDEX idx_date (myDate) + ) ENGINE=InnoDB +PARTITION BY RANGE ( TO_DAYS(myDate) ) ( + PARTITION p0 VALUES LESS THAN (734028), + PARTITION p1 VALUES LESS THAN (734029), + PARTITION p2 VALUES LESS THAN (734030), + PARTITION p3 VALUES LESS THAN MAXVALUE + ) ; +INSERT INTO t1 VALUES +(NULL, 'Lachlan', '2009-09-13'), + (NULL, 'Clint', '2009-09-13'), + (NULL, 'John', '2009-09-14'), + (NULL, 'Dave', '2009-09-14'), + (NULL, 'Jeremy', '2009-09-15'), + (NULL, 'Scott', '2009-09-15'), + (NULL, 'Jeff', '2009-09-16'), + (NULL, 'Joe', '2009-09-16'); +SET AUTOCOMMIT=0; +SELECT * FROM t1 FOR UPDATE; +UPDATE t1 SET name = 'Mattias' WHERE id = 7; +SELECT * FROM t1 WHERE id = 7; +--connect (con1, localhost, root,,) +--echo # Connection con1 +SET lock_wait_timeout = 1; +--echo # After the patch it will wait and fail on timeout. +--error ER_LOCK_WAIT_TIMEOUT +ALTER TABLE t1 DROP PARTITION p3; +SHOW WARNINGS; +--disconnect con1 +--connection default +--echo # Connection default +SELECT * FROM t1; +--echo # No changes. +COMMIT; +DROP TABLE t1; + +--echo # --echo # Bug#51830: Incorrect partition pruning on range partition (regression) --echo # CREATE TABLE t1 (a INT NOT NULL) diff --git a/mysql-test/t/partition_not_blackhole-master.opt b/mysql-test/t/partition_not_blackhole-master.opt new file mode 100644 index 00000000000..1e47be930bc --- /dev/null +++ b/mysql-test/t/partition_not_blackhole-master.opt @@ -0,0 +1 @@ +--loose-skip-blackhole diff --git a/mysql-test/t/partition_not_blackhole.test b/mysql-test/t/partition_not_blackhole.test new file mode 100644 index 00000000000..7352aeaa230 --- /dev/null +++ b/mysql-test/t/partition_not_blackhole.test @@ -0,0 +1,26 @@ +--source include/have_partition.inc +--source include/not_blackhole.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +let $MYSQLD_DATADIR= `SELECT @@datadir`; + +--echo # +--echo # Bug#46086: crash when dropping a partitioned table and +--echo # the original engine is disabled +--echo # Copy a .frm and .par file which was created with: +--echo # create table `t1` (`id` int primary key) engine=blackhole +--echo # partition by key () partitions 1; +--copy_file std_data/parts/t1_blackhole.frm $MYSQLD_DATADIR/test/t1.frm +--copy_file std_data/parts/t1_blackhole.par $MYSQLD_DATADIR/test/t1.par +SHOW TABLES; +--replace_result $MYSQLD_DATADIR ./ +--error ER_NOT_FORM_FILE +SHOW CREATE TABLE t1; +--error ER_BAD_TABLE_ERROR +DROP TABLE t1; +--list_files $MYSQLD_DATADIR/test t1* +--remove_file $MYSQLD_DATADIR/test/t1.frm +--remove_file $MYSQLD_DATADIR/test/t1.par diff --git a/mysql-test/t/partition_range.test b/mysql-test/t/partition_range.test index 673d05532eb..4e2c1b98a70 100644 --- a/mysql-test/t/partition_range.test +++ b/mysql-test/t/partition_range.test @@ -931,3 +931,44 @@ insert into t2 values(52, 20070322, 456, 'filler') ; select sum(count) from t2 ch where ch.defid in (50,52) and ch.day between 20070320 and 20070401 group by defid; drop table t1, t2; + +--echo # +--echo # Bug#50939: Loose Index Scan unduly relies on engine to remember range +--echo # endpoints +--echo # +CREATE TABLE t1 ( + a INT, + b INT, + KEY ( a, b ) +) PARTITION BY HASH (a) PARTITIONS 1; + +CREATE TABLE t2 ( + a INT, + b INT, + KEY ( a, b ) +); + +INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); + +INSERT INTO t1 SELECT a + 5, b + 5 FROM t1; +INSERT INTO t1 SELECT a + 10, b + 10 FROM t1; +INSERT INTO t1 SELECT a + 20, b + 20 FROM t1; +INSERT INTO t1 SELECT a + 40, b + 40 FROM t1; + +INSERT INTO t2 SELECT * FROM t1; + +--echo # plans should be identical +EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10,100) GROUP BY a; +EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a; + +FLUSH status; +SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100) GROUP BY a; +--echo # Should be no more than 4 reads. +SHOW status LIKE 'handler_read_key'; + +FLUSH status; +SELECT a, MAX(b) FROM t2 WHERE a IN (10, 100) GROUP BY a; +--echo # Should be no more than 4 reads. +SHOW status LIKE 'handler_read_key'; + +DROP TABLE t1, t2; diff --git a/mysql-test/t/partition_truncate.test b/mysql-test/t/partition_truncate.test index 93b9cf62d14..165213d204c 100644 --- a/mysql-test/t/partition_truncate.test +++ b/mysql-test/t/partition_truncate.test @@ -24,3 +24,10 @@ subpartitions 1 --error ER_WRONG_PARTITION_NAME alter table t1 truncate partition sp1; drop table t1; + +create table t1 (a int); +insert into t1 values (1), (3), (8); +--error ER_PARTITION_MGMT_ON_NONPARTITIONED +alter table t1 truncate partition p0; +select count(*) from t1; +drop table t1; diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index ce49ca89eca..51e362d4916 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -498,12 +498,20 @@ drop table t1,t2,t3,t4; set query_cache_wlock_invalidate=1; create table t1 (a int not null); create table t2 (a int not null); +create view v1 as select * from t1; select * from t1; select * from t2; show status like "Qcache_queries_in_cache"; lock table t1 write, t2 read; show status like "Qcache_queries_in_cache"; unlock table; +select * from t1; +# Implicit locking of t1 does not invalidate QC +show status like "Qcache_queries_in_cache"; +lock table v1 write; +show status like "Qcache_queries_in_cache"; +unlock table; +drop view v1; drop table t1,t2; set query_cache_wlock_invalidate=default; diff --git a/mysql-test/t/query_cache_28249.test b/mysql-test/t/query_cache_28249.test index c95d7553988..21768b27c2e 100644 --- a/mysql-test/t/query_cache_28249.test +++ b/mysql-test/t/query_cache_28249.test @@ -58,18 +58,18 @@ connection user3; # Typical information_schema.processlist content after sufficient sleep time # ID USER COMMAND TIME STATE INFO # .... -# 2 root Query 5 Table lock SELECT *, (SELECT COUNT(*) FROM t2) FROM t1 +# 2 root Query 5 Waiting for table level lock SELECT *, (SELECT COUNT(*) FROM t2) FROM t1 # .... # XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX # The values marked with 'X' must be reached. --echo # Poll till the select of connection user1 is blocked by the write lock on t1. let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist -WHERE state = 'Table lock' +WHERE state = 'Waiting for table level lock' AND info = '$select_for_qc'; --source include/wait_condition.inc eval SELECT user,command,state,info FROM information_schema.processlist -WHERE state = 'Table lock' +WHERE state = 'Waiting for table level lock' AND info = '$select_for_qc'; INSERT INTO t1 VALUES (4); diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 2d2a6f75d73..0ad3d3e8504 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -1314,44 +1314,15 @@ SELECT * FROM t1 FORCE INDEX (PRIMARY) DROP TABLE t1; --echo # ---echo # Bug#50939: Loose Index Scan unduly relies on engine to remember range ---echo # endpoints +--echo # Bug #54802: 'NOT BETWEEN' evaluation is incorrect --echo # -CREATE TABLE t1 ( - a INT, - b INT, - KEY ( a, b ) -) PARTITION BY HASH (a) PARTITIONS 1; - -CREATE TABLE t2 ( - a INT, - b INT, - KEY ( a, b ) -); - -INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); -INSERT INTO t1 SELECT a + 5, b + 5 FROM t1; -INSERT INTO t1 SELECT a + 10, b + 10 FROM t1; -INSERT INTO t1 SELECT a + 20, b + 20 FROM t1; -INSERT INTO t1 SELECT a + 40, b + 40 FROM t1; +CREATE TABLE t1 (c_key INT, c_notkey INT, KEY(c_key)); +INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3); -INSERT INTO t2 SELECT * FROM t1; +EXPLAIN SELECT * FROM t1 WHERE 2 NOT BETWEEN c_notkey AND c_key; +SELECT * FROM t1 WHERE 2 NOT BETWEEN c_notkey AND c_key; ---echo # plans should be identical -EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10,100) GROUP BY a; -EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a; - -FLUSH status; -SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100) GROUP BY a; ---echo # Should be no more than 4 reads. -SHOW status LIKE 'handler_read_key'; - -FLUSH status; -SELECT a, MAX(b) FROM t2 WHERE a IN (10, 100) GROUP BY a; ---echo # Should be no more than 4 reads. -SHOW status LIKE 'handler_read_key'; - -DROP TABLE t1, t2; +DROP TABLE t1; --echo End of 5.1 tests diff --git a/mysql-test/t/schema.test b/mysql-test/t/schema.test index ed3b98ec2f7..6af7ee20b02 100644 --- a/mysql-test/t/schema.test +++ b/mysql-test/t/schema.test @@ -23,7 +23,6 @@ drop schema foo; --disable_warnings DROP SCHEMA IF EXISTS schema1; -DROP SCHEMA IF EXISTS schema2; --enable_warnings connect(con2, localhost, root); @@ -32,7 +31,6 @@ connect(con2, localhost, root); connection default; CREATE SCHEMA schema1; -CREATE SCHEMA schema2; CREATE TABLE schema1.t1 (a INT); SET autocommit= FALSE; @@ -45,10 +43,13 @@ connection con2; --echo # Connection default connection default; let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist - WHERE state= 'Waiting for table' + WHERE state= 'Waiting for table metadata lock' AND info='DROP SCHEMA schema1'; --source include/wait_condition.inc -ALTER SCHEMA schema2 DEFAULT CHARACTER SET utf8; +# Error 1 is from ALTER DATABASE when the database does not exist. +# Listing the error twice to prevent result diffences based on filename. +--error 1,1 +ALTER SCHEMA schema1 DEFAULT CHARACTER SET utf8; SET autocommit= TRUE; --echo # Connection 2 @@ -57,7 +58,6 @@ connection con2; --echo # Connection default connection default; -DROP SCHEMA schema2; disconnect con2; @@ -84,7 +84,7 @@ connection con2; --echo # Connection default connection default; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist - WHERE state='Waiting for table' and info='DROP SCHEMA schema1'; + WHERE state='Waiting for schema metadata lock' and info='DROP SCHEMA schema1'; --source include/wait_condition.inc --echo # CREATE SCHEMA used to give a deadlock. @@ -124,7 +124,7 @@ connection default; --echo # Connection con2 connect (con2, localhost, root); let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist - WHERE state='Waiting for table' AND info='DROP DATABASE db1'; + WHERE state='Waiting for table metadata lock' AND info='DROP DATABASE db1'; --source include/wait_condition.inc --echo # Connection con1 @@ -172,7 +172,7 @@ connection con2; --echo # Connection 3 connection con3; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist - WHERE state='Waiting for table' and info='DROP DATABASE db1'; + WHERE state='Waiting for table metadata lock' and info='DROP DATABASE db1'; --source include/wait_condition.inc --echo # But it should still be possible to CREATE/ALTER/DROP other databases. CREATE DATABASE db2; diff --git a/mysql-test/t/sp-destruct.test b/mysql-test/t/sp-destruct.test index b7090c01f1e..a5c287e44a8 100644 --- a/mysql-test/t/sp-destruct.test +++ b/mysql-test/t/sp-destruct.test @@ -222,3 +222,33 @@ SHOW WARNINGS; --echo # Restore the procs_priv table RENAME TABLE procs_priv_backup TO mysql.procs_priv; FLUSH TABLE mysql.procs_priv; + + +--echo # +--echo # Bug #56137 "Assertion `thd->lock == 0' failed on upgrading from +--echo # 5.1.50 to 5.5.6". +--echo # +--disable_warnings +drop database if exists mysqltest; +--enable_warnings +--echo # Backup mysql.proc. +flush table mysql.proc; +let $MYSQLD_DATADIR= `select @@datadir`; +--copy_file $MYSQLD_DATADIR/mysql/proc.frm $MYSQLTEST_VARDIR/tmp/proc.frm +--copy_file $MYSQLD_DATADIR/mysql/proc.MYD $MYSQLTEST_VARDIR/tmp/proc.MYD +--copy_file $MYSQLD_DATADIR/mysql/proc.MYI $MYSQLTEST_VARDIR/tmp/proc.MYI + +create database mysqltest; +--echo # Corrupt mysql.proc to make it unusable by current version of server. +alter table mysql.proc drop column type; +--echo # The below statement should not cause assertion failure. +drop database mysqltest; + +--echo # Restore mysql.proc. +drop table mysql.proc; +--copy_file $MYSQLTEST_VARDIR/tmp/proc.frm $MYSQLD_DATADIR/mysql/proc.frm +--copy_file $MYSQLTEST_VARDIR/tmp/proc.MYD $MYSQLD_DATADIR/mysql/proc.MYD +--copy_file $MYSQLTEST_VARDIR/tmp/proc.MYI $MYSQLD_DATADIR/mysql/proc.MYI +--remove_file $MYSQLTEST_VARDIR/tmp/proc.frm +--remove_file $MYSQLTEST_VARDIR/tmp/proc.MYD +--remove_file $MYSQLTEST_VARDIR/tmp/proc.MYI diff --git a/mysql-test/t/sp-lock.test b/mysql-test/t/sp-lock.test index 7297790a886..be8369d6994 100644 --- a/mysql-test/t/sp-lock.test +++ b/mysql-test/t/sp-lock.test @@ -183,18 +183,19 @@ connection con1; send drop procedure p1; --echo # --> connection con2 connection con2; ---echo # Waitng for 'drop procedure t1' to get blocked on MDL lock... +--echo # Waiting for 'drop procedure t1' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist -where state='Waiting for table' and info='drop procedure p1'; +where state='Waiting for stored procedure metadata lock' and +info='drop procedure p1'; --source include/wait_condition.inc --echo # Demonstrate that there is a pending exclusive lock. --echo # Sending 'select f1()'... send select f1(); --echo # --> connection con3 connection con3; ---echo # Waitng for 'select f1()' to get blocked by a pending MDL lock... +--echo # Waiting for 'select f1()' to get blocked by a pending MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist -where state='Waiting for table' and info='select f1()'; +where state='Waiting for stored procedure metadata lock' and info='select f1()'; --echo # --> connection default connection default; commit; @@ -222,18 +223,19 @@ connection con1; send create procedure p1() begin end; --echo # --> connection con2 connection con2; ---echo # Waitng for 'create procedure t1' to get blocked on MDL lock... +--echo # Waiting for 'create procedure t1' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist -where state='Waiting for table' and info='create procedure p1() begin end'; +where state='Waiting for stored procedure metadata lock' and +info='create procedure p1() begin end'; --source include/wait_condition.inc --echo # Demonstrate that there is a pending exclusive lock. --echo # Sending 'select f1()'... send select f1(); --echo # --> connection con3 connection con3; ---echo # Waitng for 'select f1()' to get blocked by a pending MDL lock... +--echo # Waiting for 'select f1()' to get blocked by a pending MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist -where state='Waiting for table' and info='select f1()'; +where state='Waiting for stored procedure metadata lock' and info='select f1()'; --echo # --> connection default connection default; commit; @@ -259,18 +261,19 @@ connection con1; send alter procedure p1 contains sql; --echo # --> connection con2 connection con2; ---echo # Waitng for 'alter procedure t1' to get blocked on MDL lock... +--echo # Waiting for 'alter procedure t1' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist -where state='Waiting for table' and info='alter procedure p1 contains sql'; +where state='Waiting for stored procedure metadata lock' and +info='alter procedure p1 contains sql'; --source include/wait_condition.inc --echo # Demonstrate that there is a pending exclusive lock. --echo # Sending 'select f1()'... send select f1(); --echo # --> connection con3 connection con3; ---echo # Waitng for 'select f1()' to get blocked by a pending MDL lock... +--echo # Waiting for 'select f1()' to get blocked by a pending MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist -where state='Waiting for table' and info='select f1()'; +where state='Waiting for stored procedure metadata lock' and info='select f1()'; --echo # --> connection default connection default; commit; @@ -296,18 +299,19 @@ connection con1; send drop function f1; --echo # --> connection con2 connection con2; ---echo # Waitng for 'drop function f1' to get blocked on MDL lock... +--echo # Waiting for 'drop function f1' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist -where state='Waiting for table' and info='drop function f1'; +where state='Waiting for stored function metadata lock' and +info='drop function f1'; --source include/wait_condition.inc --echo # Demonstrate that there is a pending exclusive lock. --echo # Sending 'select f1()'... send select f1(); --echo # --> connection con3 connection con3; ---echo # Waitng for 'select f1()' to get blocked by a pending MDL lock... +--echo # Waiting for 'select f1()' to get blocked by a pending MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist -where state='Waiting for table' and info='select f1()'; +where state='Waiting for stored function metadata lock' and info='select f1()'; --echo # --> connection default connection default; commit; @@ -335,18 +339,19 @@ connection con1; send create function f1() returns int return 2; --echo # --> connection con2 connection con2; ---echo # Waitng for 'create function f1' to get blocked on MDL lock... +--echo # Waiting for 'create function f1' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist -where state='Waiting for table' and info='create function f1() returns int return 2'; +where state='Waiting for stored function metadata lock' and +info='create function f1() returns int return 2'; --source include/wait_condition.inc --echo # Demonstrate that there is a pending exclusive lock. --echo # Sending 'select f1()'... send select f1(); --echo # --> connection con3 connection con3; ---echo # Waitng for 'select f1()' to get blocked by a pending MDL lock... +--echo # Waiting for 'select f1()' to get blocked by a pending MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist -where state='Waiting for table' and info='select f1()'; +where state='Waiting for stored function metadata lock' and info='select f1()'; --echo # --> connection default connection default; commit; @@ -373,18 +378,19 @@ connection con1; send alter function f1 contains sql; --echo # --> connection con2 connection con2; ---echo # Waitng for 'alter function f1' to get blocked on MDL lock... +--echo # Waiting for 'alter function f1' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist -where state='Waiting for table' and info='alter function f1 contains sql'; +where state='Waiting for stored function metadata lock' and +info='alter function f1 contains sql'; --source include/wait_condition.inc --echo # Demonstrate that there is a pending exclusive lock. --echo # Sending 'select f1()'... send select f1(); --echo # --> connection con3 connection con3; ---echo # Waitng for 'select f1()' to get blocked by a pending MDL lock... +--echo # Waiting for 'select f1()' to get blocked by a pending MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist -where state='Waiting for table' and info='select f1()'; +where state='Waiting for stored function metadata lock' and info='select f1()'; --echo # --> connection default connection default; commit; @@ -471,9 +477,10 @@ connection con1; send drop function f1; --echo # --> connection con2 connection con2; ---echo # Waitng for 'drop function f1' to get blocked on MDL lock... +--echo # Waiting for 'drop function f1' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist -where state='Waiting for table' and info='drop function f1'; +where state='Waiting for stored function metadata lock' and +info='drop function f1'; --source include/wait_condition.inc --echo # --> connnection default connection default; @@ -497,9 +504,10 @@ connection con1; send drop function f1; --echo # --> connection con2 connection con2; ---echo # Waitng for 'drop function f1' to get blocked on MDL lock... +--echo # Waiting for 'drop function f1' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist -where state='Waiting for table' and info='drop function f1'; +where state='Waiting for stored function metadata lock' and +info='drop function f1'; --source include/wait_condition.inc --echo # --> connnection default connection default; @@ -530,9 +538,10 @@ connection con1; send drop procedure p1; --echo # --> connection con2 connection con2; ---echo # Waitng for 'drop procedure p1' to get blocked on MDL lock... +--echo # Waiting for 'drop procedure p1' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist -where state='Waiting for table' and info='drop procedure p1'; +where state='Waiting for stored procedure metadata lock' and +info='drop procedure p1'; --source include/wait_condition.inc --echo # --> connnection default connection default; @@ -561,9 +570,10 @@ connection con1; send drop function f2; --echo # --> connection con2 connection con2; ---echo # Waitng for 'drop function f2' to get blocked on MDL lock... +--echo # Waiting for 'drop function f2' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist -where state='Waiting for table' and info='drop function f2'; +where state='Waiting for stored function metadata lock' and +info='drop function f2'; --source include/wait_condition.inc --echo # --> connnection default connection default; @@ -623,17 +633,19 @@ connection con1; send drop function f1; --echo # --> connection con2 connection con2; ---echo # Waitng for 'drop function f1' to get blocked on MDL lock... +--echo # Waiting for 'drop function f1' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist -where state='Waiting for table' and info='drop function f1'; +where state='Waiting for stored function metadata lock' and +info='drop function f1'; --source include/wait_condition.inc --echo # Sending 'drop function f2'... send drop function f2; --echo # --> connection default connection default; ---echo # Waitng for 'drop function f2' to get blocked on MDL lock... +--echo # Waiting for 'drop function f2' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist -where state='Waiting for table' and info='drop function f2'; +where state='Waiting for stored function metadata lock' and +info='drop function f2'; --source include/wait_condition.inc rollback to savepoint sv; --echo # --> connection con2 @@ -699,16 +711,18 @@ connection con1; send alter function f1 comment "comment"; --echo # --> connection con2 connection con2; ---echo # Waitng for 'alter function f1 ...' to get blocked on MDL lock... +--echo # Waiting for 'alter function f1 ...' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist -where state='Waiting for table' and info like 'alter function f1 comment%'; +where state='Waiting for stored function metadata lock' and +info like 'alter function f1 comment%'; --source include/wait_condition.inc --echo # Sending 'call p1()'... send call p1(); connection default; ---echo # Waitng for 'call p1()' to get blocked on MDL lock on f1... +--echo # Waiting for 'call p1()' to get blocked on MDL lock on f1... let $wait_condition=select count(*)=1 from information_schema.processlist -where state='Waiting for table' and info='select f1() into @var'; +where state='Waiting for stored function metadata lock' and +info='select f1() into @var'; --source include/wait_condition.inc --echo # Let 'alter function f1 ...' go through... commit; @@ -746,9 +760,10 @@ connection con1; send alter function f1 comment "comment"; --echo # --> connection con2 connection con2; ---echo # Waitng for 'alter function f1 ...' to get blocked on MDL lock... +--echo # Waiting for 'alter function f1 ...' to get blocked on MDL lock... let $wait_condition=select count(*)=1 from information_schema.processlist -where state='Waiting for table' and info like 'alter function f1 comment%'; +where state='Waiting for stored function metadata lock' and +info like 'alter function f1 comment%'; --source include/wait_condition.inc delimiter |; --echo # @@ -774,9 +789,10 @@ delimiter ;| --echo # Sending 'call p1()'... send call p1(); connection default; ---echo # Waitng for 'call p1()' to get blocked on MDL lock on f1... +--echo # Waiting for 'call p1()' to get blocked on MDL lock on f1... let $wait_condition=select count(*)=1 from information_schema.processlist -where state='Waiting for table' and info='select f1() into @var'; +where state='Waiting for stored function metadata lock' and +info='select f1() into @var'; --source include/wait_condition.inc --echo # Let 'alter function f1 ...' go through... commit; @@ -825,7 +841,7 @@ connection default; send select f3(); --echo # --> connection con1 connection con1; ---echo # Waitng for 'select f3()' to get blocked on the user level lock... +--echo # Waiting for 'select f3()' to get blocked on the user level lock... let $wait_condition=select count(*)=1 from information_schema.processlist where state='User lock' and info='select f1() into @var'; --source include/wait_condition.inc diff --git a/mysql-test/t/sp_notembedded.test b/mysql-test/t/sp_notembedded.test index 83accecabb5..b15f6351e59 100644 --- a/mysql-test/t/sp_notembedded.test +++ b/mysql-test/t/sp_notembedded.test @@ -322,7 +322,7 @@ set session low_priority_updates=on; connection rl_wait; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Table lock" and + where state = "Waiting for table level lock" and info = "update t1 set value='updated' where value='old'"; --source include/wait_condition.inc diff --git a/mysql-test/t/sp_sync.test b/mysql-test/t/sp_sync.test index 431db463b67..368a09eac8c 100644 --- a/mysql-test/t/sp_sync.test +++ b/mysql-test/t/sp_sync.test @@ -87,7 +87,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR locked'; --echo # Connection con3 connection con3; let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist - WHERE state= 'Waiting for table' + WHERE state= 'Waiting for stored function metadata lock' AND info='SHOW OPEN TABLES WHERE f1()=0'; --source include/wait_condition.inc --echo # Check that the IS query is blocked before releasing the x-lock diff --git a/mysql-test/t/ssl_8k_key-master.opt b/mysql-test/t/ssl_8k_key-master.opt new file mode 100644 index 00000000000..b58ca7f39f0 --- /dev/null +++ b/mysql-test/t/ssl_8k_key-master.opt @@ -0,0 +1 @@ +--loose-ssl-key=$MYSQL_TEST_DIR/std_data/server8k-key.pem --loose-ssl-cert=$MYSQL_TEST_DIR/std_data/server8k-cert.pem diff --git a/mysql-test/t/status.test b/mysql-test/t/status.test index cca54f6c762..9965875af55 100644 --- a/mysql-test/t/status.test +++ b/mysql-test/t/status.test @@ -58,7 +58,8 @@ let $ID= `select connection_id()`; connection con2; --echo # Switched to connection: con2 # wait for the other query to start executing -let $wait_condition= select 1 from INFORMATION_SCHEMA.PROCESSLIST where ID = $ID and STATE = "Table lock"; +let $wait_condition= select 1 from INFORMATION_SCHEMA.PROCESSLIST + where ID = $ID and STATE = "Waiting for table level lock"; --source include/wait_condition.inc unlock tables; diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test index fb0f58bf804..a2c71c664c4 100644 --- a/mysql-test/t/subselect4.test +++ b/mysql-test/t/subselect4.test @@ -64,6 +64,22 @@ DROP TABLE t1,t2,t3; --echo End of 5.0 tests. --echo # +--echo # Bug#54568: create view cause Assertion failed: 0, +--echo # file .\item_subselect.cc, line 836 +--echo # +EXPLAIN SELECT 1 LIKE ( 1 IN ( SELECT 1 ) ); +DESCRIBE SELECT 1 LIKE ( 1 IN ( SELECT 1 ) ); +--echo # None of the below should crash +CREATE VIEW v1 AS SELECT 1 LIKE ( 1 IN ( SELECT 1 ) ); +CREATE VIEW v2 AS SELECT 1 LIKE '%' ESCAPE ( 1 IN ( SELECT 1 ) ); +DROP VIEW v1, v2; + + +--echo # +--echo # End of 5.1 tests. +--echo # + +--echo # --echo # Bug#53236 Segfault in DTCollation::set(DTCollation&) --echo # diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index 2eb086cace5..3e4c3660f88 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -1751,7 +1751,7 @@ create trigger t1_ai after insert on t1 for each row set @a := 7; create table t2 (j int); insert into t2 values (1), (2); set @a:=""; -create table if not exists t1 select * from t2; +insert into t1 select * from t2; select * from t1; select @a; # Let us check that trigger that involves table also works ok. @@ -1759,7 +1759,7 @@ drop trigger t1_bi; drop trigger t1_ai; create table t3 (isave int); create trigger t1_bi before insert on t1 for each row insert into t3 values (new.i); -create table if not exists t1 select * from t2; +insert into t1 select * from t2; select * from t1; select * from t3; drop table t1, t2, t3; @@ -1975,7 +1975,7 @@ select * from t1_op_log; truncate t1; truncate t1_op_log; -create table if not exists t1 +insert into t1 select NULL, "CREATE TABLE ... SELECT, inserting a new key"; set @id=last_insert_id(); @@ -1984,7 +1984,7 @@ select * from t1; select * from t1_op_log; truncate t1_op_log; -create table if not exists t1 replace +replace into t1 select @id, "CREATE TABLE ... REPLACE SELECT, deleting a duplicate key"; select * from t1; @@ -2114,7 +2114,7 @@ select * from t1_op_log; truncate t1; truncate t1_op_log; -create table if not exists v1 +insert into v1 select NULL, "CREATE TABLE ... SELECT, inserting a new key"; set @id=last_insert_id(); @@ -2123,7 +2123,7 @@ select * from t1; select * from t1_op_log; truncate t1_op_log; -create table if not exists v1 replace +replace into v1 select @id, "CREATE TABLE ... REPLACE SELECT, deleting a duplicate key"; select * from t1; diff --git a/mysql-test/t/trigger_notembedded.test b/mysql-test/t/trigger_notembedded.test index 8a570a7e87d..9728ae9a4ae 100644 --- a/mysql-test/t/trigger_notembedded.test +++ b/mysql-test/t/trigger_notembedded.test @@ -896,7 +896,7 @@ connection default; --echo connection: default let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table"; + where state = "Waiting for global metadata lock"; --source include/wait_condition.inc create trigger t1_bi before insert on t1 for each row begin end; unlock tables; diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index ab2745ceeef..93dc4cad50c 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -253,7 +253,7 @@ SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a desc LIMIT 1; create temporary table t1 select a from t1 union select a from t2; drop temporary table t1; ---error 1093 +--error ER_TABLE_EXISTS_ERROR create table t1 select a from t1 union select a from t2; --error 1054 select a from t1 union select a from t2 order by t2.a; diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index c0564a82b23..236f2e84770 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -4074,7 +4074,8 @@ connection default; connection con2; let $wait_condition= SELECT COUNT(*) = 1 from information_schema.processlist - WHERE state = "Table lock" AND info = "INSERT INTO t1 SELECT * FROM v1"; + WHERE state = "Waiting for table level lock" AND + info = "INSERT INTO t1 SELECT * FROM v1"; --source include/wait_condition.inc --echo # ... then try to drop the view. This should block. --echo # Sending: @@ -4084,7 +4085,7 @@ let $wait_condition= connection con3; let $wait_condition= SELECT COUNT(*) = 1 from information_schema.processlist - WHERE state = "Waiting for table" AND info = "DROP VIEW v1"; + WHERE state = "Waiting for table metadata lock" AND info = "DROP VIEW v1"; --source include/wait_condition.inc --echo # Now allow CALL p1() to complete UNLOCK TABLES; |