mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-240: SHOW EXPLAIN: Assertion `this->optimized == 2' failed
- Fix the bug: SHOW EXPLAIN may hit a case where a join is partially optimized. - Change JOIN::optimized to use enum instead of numeric constants
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
drop table if exists t0, t1, t2;
|
||||
drop view if exists v1;
|
||||
create table t0 (a int);
|
||||
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
create table t1 (a int);
|
||||
@ -337,4 +338,36 @@ Warnings:
|
||||
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` join `test`.`t2` group by `test`.`t2`.`a`
|
||||
set debug='';
|
||||
DROP TABLE t2;
|
||||
#
|
||||
# MDEV-240: SHOW EXPLAIN: Assertion `this->optimized == 2' failed in
|
||||
# JOIN::print_explain on query with a JOIN, TEMPTABLE view,
|
||||
#
|
||||
CREATE TABLE t3 (a INT);
|
||||
CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t3;
|
||||
INSERT INTO t3 VALUES (8);
|
||||
CREATE TABLE t2 (b INT);
|
||||
INSERT INTO t2 VALUES (4),(5),(6),(7),(8),(9);
|
||||
explain SELECT * FROM v1, t2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 6
|
||||
2 DERIVED t3 system NULL NULL NULL NULL 1
|
||||
set @show_explain_probe_select_id=2;
|
||||
set debug='d,show_explain_probe_join_exec_end';
|
||||
SELECT * FROM v1, t2;
|
||||
show explain for $thr2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Not yet optimized
|
||||
Warnings:
|
||||
Note 1003 SELECT * FROM v1, t2
|
||||
a b
|
||||
8 4
|
||||
8 5
|
||||
8 6
|
||||
8 7
|
||||
8 8
|
||||
8 9
|
||||
set debug='';
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t2, t3;
|
||||
drop table t0,t1;
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t0, t1, t2;
|
||||
drop view if exists v1;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
@ -346,6 +347,30 @@ set debug='';
|
||||
DROP TABLE t2;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-240: SHOW EXPLAIN: Assertion `this->optimized == 2' failed in
|
||||
--echo # JOIN::print_explain on query with a JOIN, TEMPTABLE view,
|
||||
--echo #
|
||||
CREATE TABLE t3 (a INT);
|
||||
CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t3;
|
||||
INSERT INTO t3 VALUES (8);
|
||||
CREATE TABLE t2 (b INT);
|
||||
INSERT INTO t2 VALUES (4),(5),(6),(7),(8),(9);
|
||||
explain SELECT * FROM v1, t2;
|
||||
|
||||
set @show_explain_probe_select_id=2;
|
||||
set debug='d,show_explain_probe_join_exec_end';
|
||||
send SELECT * FROM v1, t2;
|
||||
|
||||
connection default;
|
||||
--source include/wait_condition.inc
|
||||
evalp show explain for $thr2;
|
||||
connection con1;
|
||||
reap;
|
||||
set debug='';
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t2, t3;
|
||||
|
||||
## TODO: Test this: have several SHOW EXPLAIN requests be queued up for a
|
||||
## thread and served together.
|
||||
|
||||
|
Reference in New Issue
Block a user