diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2016-12-22 16:48:49 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2016-12-22 16:48:49 +0200 |
commit | 08f79bdeda89f5b8e09d99e7dc07fc9c4f8ef14f (patch) | |
tree | 3756a3625bc2aa6677b18b6ca1084cc9ed785955 /mysql-test/include/mix1.inc | |
parent | d6a1f9f10f21bfb5198b81c40e09755651013e09 (diff) | |
download | mariadb-git-08f79bdeda89f5b8e09d99e7dc07fc9c4f8ef14f.tar.gz |
MDEV-11635 innodb.innodb_mysql test hangs
Copy and adapt the test from MySQL 5.7.17.
Diffstat (limited to 'mysql-test/include/mix1.inc')
-rw-r--r-- | mysql-test/include/mix1.inc | 114 |
1 files changed, 107 insertions, 7 deletions
diff --git a/mysql-test/include/mix1.inc b/mysql-test/include/mix1.inc index 5e6797e69ff..ea7bc3f5327 100644 --- a/mysql-test/include/mix1.inc +++ b/mysql-test/include/mix1.inc @@ -236,6 +236,15 @@ create table t2i (a int); insert into t2m values (5); insert into t2i values (5); +-- disable_query_log +-- disable_result_log +analyze table t1i; +analyze table t1m; +analyze table t2i; +analyze table t2m; +-- enable_result_log +-- enable_query_log + # test with $engine_type select min(a) from t1i; select min(7) from t1i; @@ -411,6 +420,13 @@ if ($test_foreign_keys) INSERT INTO t1 VALUES (1,'A1'),(2,'A2'),(3,'B'); INSERT INTO t2 VALUES (1,1),(2,2),(3,2),(4,3),(5,3); +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t1; +ANALYZE TABLE t2; +-- enable_result_log +-- enable_query_log + EXPLAIN SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id WHERE t1.name LIKE 'A%'; @@ -572,12 +588,22 @@ OPTIMIZE TABLE t1; SELECT COUNT(*) FROM t1; SELECT COUNT(*) FROM t1 WHERE acct_id=785; +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t1; +-- enable_result_log +-- enable_query_log + EXPLAIN SELECT COUNT(*) FROM t1 WHERE stat_id IN (1,3) AND acct_id=785; INSERT INTO t2 SELECT * FROM t1; OPTIMIZE TABLE t2; -EXPLAIN SELECT COUNT(*) FROM t2 WHERE stat_id IN (1,3) AND acct_id=785; +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t2; +-- enable_result_log +-- enable_query_log DROP TABLE t1,t2; @@ -704,6 +730,13 @@ INSERT INTO t1(b,c) SELECT b,c FROM t2; UPDATE t2 SET c='2007-01-03'; INSERT INTO t1(b,c) SELECT b,c FROM t2; +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t1; +ANALYZE TABLE t2; +-- enable_result_log +-- enable_query_log + set @@sort_buffer_size=8192; SELECT COUNT(*) FROM t1; @@ -793,6 +826,12 @@ INSERT INTO t1 SELECT a + 16, MOD(a + 16, 20), 1 FROM t1; INSERT INTO t1 SELECT a + 32, MOD(a + 32, 20), 1 FROM t1; INSERT INTO t1 SELECT a + 64, MOD(a + 64, 20), 1 FROM t1; +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t1; +-- enable_result_log +-- enable_query_log + EXPLAIN SELECT b, SUM(c) FROM t1 GROUP BY b; EXPLAIN SELECT SQL_BIG_RESULT b, SUM(c) FROM t1 GROUP BY b; DROP TABLE t1; @@ -855,6 +894,11 @@ CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY bkey (b)) ENGINE=InnoDB; INSERT INTO t1 VALUES (1,2),(3,2),(2,2),(4,2),(5,2),(6,2),(7,2),(8,2); INSERT INTO t1 SELECT a + 8, 2 FROM t1; INSERT INTO t1 SELECT a + 16, 1 FROM t1; +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t1; +-- enable_result_log +-- enable_query_log query_vertical EXPLAIN SELECT * FROM t1 WHERE b=2 ORDER BY a; SELECT * FROM t1 WHERE b=2 ORDER BY a; query_vertical EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a; @@ -868,6 +912,12 @@ INSERT INTO t2 VALUES (1,1,1),(3,1,1),(2,1,1),(4,1,1); INSERT INTO t2 SELECT a + 4, 1, 1 FROM t2; INSERT INTO t2 SELECT a + 8, 1, 1 FROM t2; +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t2; +-- enable_result_log +-- enable_query_log + query_vertical EXPLAIN SELECT * FROM t2 WHERE b=1 ORDER BY a; SELECT * FROM t2 WHERE b=1 ORDER BY a; query_vertical EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a; @@ -959,7 +1009,7 @@ SELECT * FROM t1 WHERE b=20 FOR UPDATE; --connect (conn2, localhost, root,,test) -# This statement gives a "failed: 1205: Lock wait timeout exceeded; try +# This statement gives a "failed: 1205: Lock wait timeout exceeded; try # restarting transaction" message when the bug is present. START TRANSACTION; SELECT * FROM t1 WHERE b=10 ORDER BY A FOR UPDATE; @@ -984,6 +1034,12 @@ CREATE TABLE t1( INSERT INTO t1 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4); +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t1; +-- enable_result_log +-- enable_query_log + EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d; SELECT c,b,d FROM t1 GROUP BY c,b,d; EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d ORDER BY NULL; @@ -1004,6 +1060,12 @@ DROP TABLE t1; CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a), INDEX b (b)) ENGINE=InnoDB; INSERT INTO t1(a,b) VALUES (1,1), (2,2), (3,2); +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t1; +-- enable_result_log +-- enable_query_log + #The two queries below should produce different results, but they don't. query_vertical EXPLAIN SELECT * FROM t1 WHERE b=2 ORDER BY a ASC; SELECT * FROM t1 WHERE b=2 ORDER BY a ASC; @@ -1087,6 +1149,12 @@ CREATE TABLE t1 (id int, type char(6), d int, INDEX idx(id,d)) ENGINE=InnoDB; INSERT INTO t1 VALUES (191, 'member', 1), (NULL, 'member', 3), (NULL, 'member', 4), (201, 'member', 2); +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t1; +-- enable_result_log +-- enable_query_log + EXPLAIN SELECT * FROM t1 WHERE id=191 OR id IS NULL ORDER BY d; SELECT * FROM t1 WHERE id=191 OR id IS NULL ORDER BY d; @@ -1115,12 +1183,13 @@ CREATE TABLE t1 (a int, b int, c int, PRIMARY KEY (a), KEY t1_b (b)) INSERT INTO t1 (a,b,c) VALUES (1,1,1), (2,1,1), (3,1,1), (4,1,1); INSERT INTO t1 (a,b,c) SELECT a+4,b,c FROM t1; -# should be range access +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t1; +-- enable_result_log +-- enable_query_log -# -# InnoDB uses "where", while xtradb "index condition" -# ---replace_regex /where/index condition/ +# should be range access EXPLAIN SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5; # should produce '8 7 6 5 4' for a @@ -1514,6 +1583,12 @@ INSERT INTO t1 VALUES (4,1,3,'pk',NULL),(5,1,3,'c2',NULL), (2,1,4,'c_extra',NULL),(3,1,4,'c_extra',NULL); +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t1; +-- enable_result_log +-- enable_query_log + EXPLAIN SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE tid = 1 AND vid = 3 ORDER BY idx DESC; SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE tid = 1 AND vid = 3 ORDER BY idx DESC; @@ -1531,6 +1606,12 @@ CREATE TABLE t1 (c1 INT, c2 INT, c3 INT, KEY (c3), KEY (c2, c3)) ENGINE=$engine_type; INSERT INTO t1 VALUES (1,1,1), (1,1,1), (1,1,2), (1,1,1), (1,1,2); +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t1; +-- enable_result_log +-- enable_query_log + SELECT 1 FROM (SELECT COUNT(DISTINCT c1) FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x; EXPLAIN @@ -1544,6 +1625,12 @@ CREATE TABLE t1 (c1 REAL, c2 REAL, c3 REAL, KEY (c3), KEY (c2, c3)) ENGINE=$engine_type; INSERT INTO t1 VALUES (1,1,1), (1,1,1), (1,1,2), (1,1,1), (1,1,2); +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t1; +-- enable_result_log +-- enable_query_log + SELECT 1 FROM (SELECT COUNT(DISTINCT c1) FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x; EXPLAIN @@ -1558,6 +1645,12 @@ CREATE TABLE t1 (c1 DECIMAL(12,2), c2 DECIMAL(12,2), c3 DECIMAL(12,2), ENGINE=$engine_type; INSERT INTO t1 VALUES (1,1,1), (1,1,1), (1,1,2), (1,1,1), (1,1,2); +-- disable_query_log +-- disable_result_log +ANALYZE TABLE t1; +-- enable_result_log +-- enable_query_log + SELECT 1 FROM (SELECT COUNT(DISTINCT c1) FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x; EXPLAIN @@ -1585,6 +1678,13 @@ CREATE TABLE t2 ( insert into t1 values (0),(1),(2),(3),(4); insert into t2 select A.a + 10 *B.a, 1, 'filler' from t1 A, t1 B; +-- disable_query_log +-- disable_result_log +analyze table t1; +analyze table t2; +-- enable_result_log +-- enable_query_log + explain select * from t1, t2 where t2.a=t1.a and t2.b + 1; select * from t1, t2 where t2.a=t1.a and t2.b + 1; |