Commit e3f56254 authored by Monty's avatar Monty

MDEV-30098 Server crashes in ha_myisam::index_read_map with index_merge_sort_intersection=on

Fixes also
MDEV-30104 Server crashes in handler_rowid_filter_check upon ANALYZE TABLE

cancel_pushed_rowid_filter() didn't inform the handler that rowid_filter
was canceled.
parent 76d2a77d
......@@ -2818,3 +2818,44 @@ drop table t;
#
# End of 10.8 tests
#
CREATE TABLE t1 (pk INT, a INT, PRIMARY KEY(pk), KEY(a)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,NULL),(2,NULL),(3,1),(4,5);
SET @save_optimizer_switch= @@optimizer_switch;
SET optimizer_switch='index_merge_sort_intersection=on';
SELECT pk FROM t1 WHERE pk > 2 AND a IS NULL;
pk
SET @@optimizer_switch= @save_optimizer_switch;
drop table t1;
#
# MDEV-30104 Server crashes in handler_rowid_filter_check upon ANALYZE TABLE
#
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (b INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1),(2);
CREATE TABLE t3 (c INT) ENGINE=MyISAM;
INSERT INTO t3 VALUES (1),(2);
CREATE TABLE t4 (pk INT, f CHAR(8), PRIMARY KEY(pk), KEY(f)) ENGINE=MyISAM;
INSERT INTO t4 VALUES (1,'o'),(2,'x');
ANALYZE TABLE t1, t2, t3, t4 PERSISTENT FOR ALL;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
test.t4 analyze status Engine-independent statistics collected
test.t4 analyze status OK
SELECT * FROM t1 LEFT JOIN (t2 JOIN t3 ON 1) ON 2 IN (SELECT pk FROM t4 WHERE f < 's');
a b c
1 NULL NULL
2 NULL NULL
ANALYZE TABLE t4 PERSISTENT FOR ALL;
Table Op Msg_type Msg_text
test.t4 analyze status Engine-independent statistics collected
test.t4 analyze status Table is already up to date
DROP TABLE t1, t2, t3, t4;
#
# End of 11.0 tests
#
......@@ -1916,3 +1916,38 @@ drop table t;
--echo #
--echo # End of 10.8 tests
--echo #
CREATE TABLE t1 (pk INT, a INT, PRIMARY KEY(pk), KEY(a)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,NULL),(2,NULL),(3,1),(4,5);
SET @save_optimizer_switch= @@optimizer_switch;
SET optimizer_switch='index_merge_sort_intersection=on';
SELECT pk FROM t1 WHERE pk > 2 AND a IS NULL;
SET @@optimizer_switch= @save_optimizer_switch;
drop table t1;
--echo #
--echo # MDEV-30104 Server crashes in handler_rowid_filter_check upon ANALYZE TABLE
--echo #
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (b INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1),(2); # Optional, fails either way
CREATE TABLE t3 (c INT) ENGINE=MyISAM;
INSERT INTO t3 VALUES (1),(2); # Optional, fails either way
CREATE TABLE t4 (pk INT, f CHAR(8), PRIMARY KEY(pk), KEY(f)) ENGINE=MyISAM;
INSERT INTO t4 VALUES (1,'o'),(2,'x');
ANALYZE TABLE t1, t2, t3, t4 PERSISTENT FOR ALL; # Optional, fails either way
SELECT * FROM t1 LEFT JOIN (t2 JOIN t3 ON 1) ON 2 IN (SELECT pk FROM t4 WHERE f < 's');
ANALYZE TABLE t4 PERSISTENT FOR ALL;
DROP TABLE t1, t2, t3, t4;
--echo #
--echo # End of 11.0 tests
--echo #
......@@ -4647,7 +4647,11 @@ class handler :public Sql_alloc
virtual void cancel_pushed_rowid_filter()
{
pushed_rowid_filter= NULL;
rowid_filter_is_active= false;
if (rowid_filter_is_active)
{
rowid_filter_is_active= false;
rowid_filter_changed();
}
}
virtual void disable_pushed_rowid_filter()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment