mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
BUG#21339: Crash at EXPLAIN PARTITIONS
Caused by missing check for end of partitions in prune range check mysql-test/r/partition.result: Added test case for duplicate bug#21388 mysql-test/r/partition_range.result: Added new test case for bug#21339 mysql-test/t/partition.test: Added test case for duplicate bug#21388 mysql-test/t/partition_range.test: Added new test case for bug#21339 sql/sql_partition.cc: Check so that we don't set outer range to be larger than max_partition
This commit is contained in:
parent
5e2babfe62
commit
d6c2a6daec
5 changed files with 76 additions and 4 deletions
|
@ -1117,4 +1117,32 @@ hello/master-data/tmpinx/t1#P#p1#SP#subpart11.MYI
|
||||||
hello/master-data/tmpinx/t1#P#p2#SP#subpart20.MYI
|
hello/master-data/tmpinx/t1#P#p2#SP#subpart20.MYI
|
||||||
hello/master-data/tmpinx/t1#P#p2#SP#subpart21.MYI
|
hello/master-data/tmpinx/t1#P#p2#SP#subpart21.MYI
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
create table t1 (a bigint unsigned not null, primary key(a))
|
||||||
|
engine = myisam
|
||||||
|
partition by key (a)
|
||||||
|
partitions 10;
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` bigint(20) unsigned NOT NULL,
|
||||||
|
PRIMARY KEY (`a`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) PARTITIONS 10 */
|
||||||
|
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE),
|
||||||
|
(18446744073709551613), (18446744073709551612);
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
18446744073709551612
|
||||||
|
18446744073709551613
|
||||||
|
18446744073709551614
|
||||||
|
18446744073709551615
|
||||||
|
select * from t1 where a = 18446744073709551615;
|
||||||
|
a
|
||||||
|
18446744073709551615
|
||||||
|
delete from t1 where a = 18446744073709551615;
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
18446744073709551612
|
||||||
|
18446744073709551613
|
||||||
|
18446744073709551614
|
||||||
|
drop table t1;
|
||||||
End of 5.1 tests
|
End of 5.1 tests
|
||||||
|
|
|
@ -1,4 +1,14 @@
|
||||||
drop table if exists t1;
|
drop table if exists t1;
|
||||||
|
create table t1 (a date)
|
||||||
|
engine = innodb
|
||||||
|
partition by range (year(a))
|
||||||
|
(partition p0 values less than (2006),
|
||||||
|
partition p1 values less than (2007));
|
||||||
|
explain partitions select * from t1
|
||||||
|
where a between '2006-01-01' and '2007-06-01';
|
||||||
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 Using where
|
||||||
|
drop table t1;
|
||||||
create table t1 (a int unsigned)
|
create table t1 (a int unsigned)
|
||||||
partition by range (a)
|
partition by range (a)
|
||||||
(partition pnull values less than (0),
|
(partition pnull values less than (0),
|
||||||
|
|
|
@ -1300,4 +1300,22 @@ eval ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
|
||||||
drop table t1;
|
drop table t1;
|
||||||
--exec rmdir $MYSQLTEST_VARDIR/master-data/tmpdata || true
|
--exec rmdir $MYSQLTEST_VARDIR/master-data/tmpdata || true
|
||||||
--exec rmdir $MYSQLTEST_VARDIR/master-data/tmpinx || true
|
--exec rmdir $MYSQLTEST_VARDIR/master-data/tmpinx || true
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug 21388: Bigint fails to find record
|
||||||
|
#
|
||||||
|
create table t1 (a bigint unsigned not null, primary key(a))
|
||||||
|
engine = myisam
|
||||||
|
partition by key (a)
|
||||||
|
partitions 10;
|
||||||
|
|
||||||
|
show create table t1;
|
||||||
|
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE),
|
||||||
|
(18446744073709551613), (18446744073709551612);
|
||||||
|
select * from t1;
|
||||||
|
select * from t1 where a = 18446744073709551615;
|
||||||
|
delete from t1 where a = 18446744073709551615;
|
||||||
|
select * from t1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
--echo End of 5.1 tests
|
--echo End of 5.1 tests
|
||||||
|
|
|
@ -9,6 +9,18 @@
|
||||||
drop table if exists t1;
|
drop table if exists t1;
|
||||||
--enable_warnings
|
--enable_warnings
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug 21339: Crash in Explain Partitions
|
||||||
|
#
|
||||||
|
create table t1 (a date)
|
||||||
|
engine = innodb
|
||||||
|
partition by range (year(a))
|
||||||
|
(partition p0 values less than (2006),
|
||||||
|
partition p1 values less than (2007));
|
||||||
|
explain partitions select * from t1
|
||||||
|
where a between '2006-01-01' and '2007-06-01';
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
# More checks for partition pruning
|
# More checks for partition pruning
|
||||||
#
|
#
|
||||||
|
@ -686,3 +698,4 @@ EXPLAIN PARTITIONS SELECT * from t1
|
||||||
WHERE (a >= '2004-07-01' AND a <= '2004-09-30') OR
|
WHERE (a >= '2004-07-01' AND a <= '2004-09-30') OR
|
||||||
(a >= '2005-07-01' AND a <= '2005-09-30');
|
(a >= '2005-07-01' AND a <= '2005-09-30');
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
|
|
@ -2573,10 +2573,13 @@ uint32 get_partition_id_range_for_endpoint(partition_info *part_info,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (part_func_value == range_array[loc_part_id])
|
if (loc_part_id < max_partition)
|
||||||
loc_part_id += test(include_endpoint);
|
{
|
||||||
else if (part_func_value > range_array[loc_part_id])
|
if (part_func_value == range_array[loc_part_id])
|
||||||
loc_part_id++;
|
loc_part_id += test(include_endpoint);
|
||||||
|
else if (part_func_value > range_array[loc_part_id])
|
||||||
|
loc_part_id++;
|
||||||
|
}
|
||||||
loc_part_id++;
|
loc_part_id++;
|
||||||
}
|
}
|
||||||
DBUG_RETURN(loc_part_id);
|
DBUG_RETURN(loc_part_id);
|
||||||
|
|
Loading…
Add table
Reference in a new issue