MDEV-5106: Server crashes in Explain_union::print_explain on ER_TOO_BIG_SELECT
- Don't save UNION's EXPLAIN data if optimization failed with an error. We could end up saving incomplete plan, which will cause a crash when we attempt to print it.
This commit is contained in:
parent
582ecb2a25
commit
094f70fd19
@ -26,3 +26,16 @@ SELECT 1;
|
||||
EXPLAIN PARTITIONS SELECT 1 ;
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
#
|
||||
# MDEV-5106: Server crashes in Explain_union::print_explain on ER_TOO_BIG_SELECT with explain in slow log
|
||||
#
|
||||
CREATE TABLE t1 (i INT) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES
|
||||
(1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
|
||||
SET max_join_size = 10;
|
||||
( SELECT ta.* FROM t1 ta, t1 tb ) UNION ( SELECT * FROM t1 );
|
||||
ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay
|
||||
SELECT 'Server still alive?' as 'Yes';
|
||||
Yes
|
||||
Server still alive?
|
||||
DROP TABLE t1;
|
||||
|
@ -169,4 +169,3 @@ explain insert into t2 values
|
||||
(11, 1+(select max(a+1) from t1));
|
||||
|
||||
drop table t1,t2;
|
||||
|
||||
|
@ -35,3 +35,15 @@ SELECT 1;
|
||||
EXPLAIN PARTITIONS SELECT 1 ;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-5106: Server crashes in Explain_union::print_explain on ER_TOO_BIG_SELECT with explain in slow log
|
||||
--echo #
|
||||
CREATE TABLE t1 (i INT) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES
|
||||
(1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
|
||||
SET max_join_size = 10;
|
||||
--error ER_TOO_BIG_SELECT
|
||||
( SELECT ta.* FROM t1 ta, t1 tb ) UNION ( SELECT * FROM t1 );
|
||||
SELECT 'Server still alive?' as 'Yes';
|
||||
|
||||
DROP TABLE t1;
|
||||
|
@ -157,6 +157,10 @@ bool print_explain_query(LEX *lex, THD *thd, String *str)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Return tabular EXPLAIN output as a text string
|
||||
*/
|
||||
|
||||
bool Explain_query::print_explain_str(THD *thd, String *out_str)
|
||||
{
|
||||
List<Item> fields;
|
||||
|
@ -630,7 +630,7 @@ bool st_select_lex_unit::exec()
|
||||
|
||||
saved_error= optimize();
|
||||
|
||||
if (!was_executed && thd->lex->explain)
|
||||
if (!saved_error && !was_executed && thd->lex->explain)
|
||||
save_union_explain(thd->lex->explain);
|
||||
|
||||
if (uncacheable || !item || !item->assigned() || describe)
|
||||
|
Loading…
x
Reference in New Issue
Block a user