Commit 7b5654f3 authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-14667 Assertion `used_parts > 0' failed in ha_partition::init_record_priority_queue.

Do not fail fi all the partitions were pruned out.
parent 39d8652c
......@@ -3485,6 +3485,16 @@ a b c d
1 a b 1
drop table t1;
#
# MDEV-14667 Assertion `used_parts > 0' failed in ha_partition::init_record_priority_queue.
#
create table t1 (a int);
insert into t1 values (1),(2);
create table t2 (b int, c int, key(c,b)) partition by hash(b) partitions 2;
insert into t2 values (3,4),(5,6);
select straight_join * from t1, t2 where b != NULL;
a b c
drop table t1, t2;
#
# MDEV-17493: Partition pruning doesn't work for nested outer joins
#
create table t0(a int);
......
......@@ -1536,6 +1536,19 @@ select * from t1 where (a = 1 AND b < 'd' AND (c = 'b' OR (c = 'c' AND d = 1)) O
(a = 1 AND b >= 'a' AND (c = 'c' OR (c = 'd' AND d = 2))));
drop table t1;
--echo #
--echo # MDEV-14667 Assertion `used_parts > 0' failed in ha_partition::init_record_priority_queue.
--echo #
create table t1 (a int);
insert into t1 values (1),(2);
create table t2 (b int, c int, key(c,b)) partition by hash(b) partitions 2;
insert into t2 values (3,4),(5,6);
select straight_join * from t1, t2 where b != NULL;
drop table t1, t2;
--echo #
--echo # MDEV-17493: Partition pruning doesn't work for nested outer joins
--echo #
......
......@@ -5265,7 +5265,10 @@ bool ha_partition::init_record_priority_queue()
{
size_t alloc_len;
uint used_parts= bitmap_bits_set(&m_part_info->read_partitions);
DBUG_ASSERT(used_parts > 0);
if (used_parts == 0) /* Do nothing since no records expected. */
DBUG_RETURN(false);
/* Allocate record buffer for each used partition. */
m_priority_queue_rec_len= m_rec_length + PARTITION_BYTES_IN_POS;
if (!m_using_extended_keys)
......
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