Commit 93892521 authored by Monty's avatar Monty

MDEV-19254 Server crashes in maria_status with partitioned table

Bug was that storage_engine::info() was called with not opened table in
ha_partition::info(). Fixed by ensuring that we are using an opened table.
parent 6dd3f240
CREATE TABLE t (a INT, KEY(a)) ENGINE=Aria PARTITION BY KEY(a) PARTITIONS 2;
SELECT * FROM t PARTITION (p1);
a
DROP TABLE t;
--source include/have_partition.inc
#
# MDEV-19254
# Server crashes in maria_status / ha_maria::info upon SELECT with partition
# pruning
#
CREATE TABLE t (a INT, KEY(a)) ENGINE=Aria PARTITION BY KEY(a) PARTITIONS 2;
SELECT * FROM t PARTITION (p1);
DROP TABLE t;
......@@ -8304,6 +8304,7 @@ int ha_partition::info(uint flag)
ulonglong max_records= 0;
uint32 i= 0;
uint32 handler_instance= 0;
bool handler_instance_set= 0;
file_array= m_file;
do
......@@ -8316,8 +8317,9 @@ int ha_partition::info(uint flag)
!bitmap_is_set(&(m_part_info->read_partitions),
(uint) (file_array - m_file)))
file->info(HA_STATUS_VARIABLE | no_lock_flag | extra_var_flag);
if (file->stats.records > max_records)
if (file->stats.records > max_records || !handler_instance_set)
{
handler_instance_set= 1;
max_records= file->stats.records;
handler_instance= i;
}
......
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