BUG#902632: Crash or invalid read at st_join_table::cleanup, st_table::disable_keyread
- Do a "more thorough" cleanup of SJ-Materialization join tab in JOIN_TAB::cleanup. The bug was due to the fact that JOIN_TAB::cleanup() may be called multiple times for the same tab if the join has grouping.
This commit is contained in:
parent
988bd172b9
commit
190aa08557
@ -1764,6 +1764,22 @@ SELECT MIN(a) FROM t1, t2 WHERE b IN (SELECT c FROM t3 GROUP BY c);
|
|||||||
MIN(a)
|
MIN(a)
|
||||||
1
|
1
|
||||||
DROP TABLE t1,t2,t3;
|
DROP TABLE t1,t2,t3;
|
||||||
|
#
|
||||||
|
# BUG#902632: Crash or invalid read at st_join_table::cleanup, st_table::disable_keyread
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 ( a INT );
|
||||||
|
INSERT INTO t1 VALUES (1), (2);
|
||||||
|
CREATE TABLE t2 ( b INT );
|
||||||
|
INSERT INTO t2 VALUES (3), (4);
|
||||||
|
CREATE TABLE t3 ( c INT );
|
||||||
|
INSERT INTO t3 VALUES (5), (6);
|
||||||
|
SELECT * FROM t1 WHERE EXISTS (
|
||||||
|
SELECT DISTINCT b FROM t2
|
||||||
|
WHERE b <= a
|
||||||
|
AND b IN ( SELECT c FROM t3 GROUP BY c )
|
||||||
|
);
|
||||||
|
a
|
||||||
|
DROP TABLE t1,t2,t3;
|
||||||
# This must be at the end:
|
# This must be at the end:
|
||||||
set optimizer_switch=@subselect_sj_mat_tmp;
|
set optimizer_switch=@subselect_sj_mat_tmp;
|
||||||
set @subselect_mat_test_optimizer_switch_value=null;
|
set @subselect_mat_test_optimizer_switch_value=null;
|
||||||
|
@ -1800,5 +1800,21 @@ SELECT MIN(a) FROM t1, t2 WHERE b IN (SELECT c FROM t3 GROUP BY c);
|
|||||||
MIN(a)
|
MIN(a)
|
||||||
1
|
1
|
||||||
DROP TABLE t1,t2,t3;
|
DROP TABLE t1,t2,t3;
|
||||||
|
#
|
||||||
|
# BUG#902632: Crash or invalid read at st_join_table::cleanup, st_table::disable_keyread
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 ( a INT );
|
||||||
|
INSERT INTO t1 VALUES (1), (2);
|
||||||
|
CREATE TABLE t2 ( b INT );
|
||||||
|
INSERT INTO t2 VALUES (3), (4);
|
||||||
|
CREATE TABLE t3 ( c INT );
|
||||||
|
INSERT INTO t3 VALUES (5), (6);
|
||||||
|
SELECT * FROM t1 WHERE EXISTS (
|
||||||
|
SELECT DISTINCT b FROM t2
|
||||||
|
WHERE b <= a
|
||||||
|
AND b IN ( SELECT c FROM t3 GROUP BY c )
|
||||||
|
);
|
||||||
|
a
|
||||||
|
DROP TABLE t1,t2,t3;
|
||||||
# This must be at the end:
|
# This must be at the end:
|
||||||
set optimizer_switch=@subselect_sj_mat_tmp;
|
set optimizer_switch=@subselect_sj_mat_tmp;
|
||||||
|
@ -1465,6 +1465,23 @@ SELECT MIN(a) FROM t1, t2 WHERE b IN (SELECT c FROM t3 GROUP BY c);
|
|||||||
|
|
||||||
DROP TABLE t1,t2,t3;
|
DROP TABLE t1,t2,t3;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # BUG#902632: Crash or invalid read at st_join_table::cleanup, st_table::disable_keyread
|
||||||
|
--echo #
|
||||||
|
CREATE TABLE t1 ( a INT );
|
||||||
|
INSERT INTO t1 VALUES (1), (2);
|
||||||
|
CREATE TABLE t2 ( b INT );
|
||||||
|
INSERT INTO t2 VALUES (3), (4);
|
||||||
|
CREATE TABLE t3 ( c INT );
|
||||||
|
INSERT INTO t3 VALUES (5), (6);
|
||||||
|
|
||||||
|
SELECT * FROM t1 WHERE EXISTS (
|
||||||
|
SELECT DISTINCT b FROM t2
|
||||||
|
WHERE b <= a
|
||||||
|
AND b IN ( SELECT c FROM t3 GROUP BY c )
|
||||||
|
);
|
||||||
|
DROP TABLE t1,t2,t3;
|
||||||
|
|
||||||
--echo # This must be at the end:
|
--echo # This must be at the end:
|
||||||
set optimizer_switch=@subselect_sj_mat_tmp;
|
set optimizer_switch=@subselect_sj_mat_tmp;
|
||||||
|
|
||||||
|
@ -9738,6 +9738,12 @@ void JOIN_TAB::cleanup()
|
|||||||
{
|
{
|
||||||
end_read_record(&read_record);
|
end_read_record(&read_record);
|
||||||
table->pos_in_table_list->jtbm_subselect->cleanup();
|
table->pos_in_table_list->jtbm_subselect->cleanup();
|
||||||
|
/*
|
||||||
|
The above call freed the materializedd temptable. Set it to NULL so
|
||||||
|
that we don't attempt to touch it if JOIN_TAB::cleanup() is invoked
|
||||||
|
multiple times (it may be)
|
||||||
|
*/
|
||||||
|
table=NULL;
|
||||||
}
|
}
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user