diff options
author | Varun Gupta <varun.gupta@mariadb.com> | 2020-08-27 17:34:12 +0530 |
---|---|---|
committer | Varun Gupta <varun.gupta@mariadb.com> | 2020-08-27 17:58:13 +0530 |
commit | f69cc26757733724254ee37aec5a092f520d230f (patch) | |
tree | 08f8ee76a48b3db5891a1ebc112409de08be2b66 /mysql-test | |
parent | 62d1e3bf67a12eb6f48ac615bda119e2ed65cf16 (diff) | |
download | mariadb-git-f69cc26757733724254ee37aec5a092f520d230f.tar.gz |
MDEV-23596: Assertion `tab->ref.use_count' failed in join_read_key_unlock_rowbb-10.1-varun
The issue here was that the query was using ORDER BY LIMIT optimzation where
the access method was changed from EQ_REF access to an index scan (index that would
resolve the ORDER BY clause).
But the parameter READ_RECORD::unlock_row was not reset to rr_unlock_row, which is
used when the access method is not EQ_REF access.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/order_by.result | 16 | ||||
-rw-r--r-- | mysql-test/t/order_by.test | 15 |
2 files changed, 31 insertions, 0 deletions
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index ffb37c9309f..f7427bcd30e 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -3356,3 +3356,19 @@ SET max_sort_length= @save_max_sort_length; SET sort_buffer_size= @save_sort_buffer_size; SET max_length_for_sort_data= @save_max_length_for_sort_data; DROP TABLE t1; +# +# MDEV-23596: Assertion `tab->ref.use_count' failed in join_read_key_unlock_row +# +CREATE TABLE t1 (a INT PRIMARY KEY, b INT, KEY(b)); +INSERT INTO t1 VALUES (0, 1),(1, 2); +CREATE TABLE t2 SELECT * FROM t1; +EXPLAIN SELECT (SELECT 1 FROM t1 WHERE t1.a=t2.b ORDER BY t1.b LIMIT 1) AS c FROM t2; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 +2 DEPENDENT SUBQUERY t1 index PRIMARY b 5 NULL 1 Using where +SELECT (SELECT 1 FROM t1 WHERE t1.a=t2.b ORDER BY t1.b LIMIT 1) AS c FROM t2; +c +1 +NULL +DROP TABLE t1,t2; +# end of 10.1 tests diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index 3a30e0b6c76..3e614ed3316 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -2196,3 +2196,18 @@ SET max_sort_length= @save_max_sort_length; SET sort_buffer_size= @save_sort_buffer_size; SET max_length_for_sort_data= @save_max_length_for_sort_data; DROP TABLE t1; + +--echo # +--echo # MDEV-23596: Assertion `tab->ref.use_count' failed in join_read_key_unlock_row +--echo # + +CREATE TABLE t1 (a INT PRIMARY KEY, b INT, KEY(b)); +INSERT INTO t1 VALUES (0, 1),(1, 2); +CREATE TABLE t2 SELECT * FROM t1; + +EXPLAIN SELECT (SELECT 1 FROM t1 WHERE t1.a=t2.b ORDER BY t1.b LIMIT 1) AS c FROM t2; +SELECT (SELECT 1 FROM t1 WHERE t1.a=t2.b ORDER BY t1.b LIMIT 1) AS c FROM t2; + +DROP TABLE t1,t2; + +--echo # end of 10.1 tests |