Skip to content
Permalink
Browse files

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.
  • Loading branch information...
montywi committed Aug 19, 2019
1 parent 6dd3f24 commit 938925211a6ea23b06859a875a3891810ed5e6e9
Showing with 18 additions and 1 deletion.
  1. +4 −0 mysql-test/suite/maria/partition.result
  2. +11 −0 mysql-test/suite/maria/partition.test
  3. +3 −1 sql/ha_partition.cc
@@ -0,0 +1,4 @@
CREATE TABLE t (a INT, KEY(a)) ENGINE=Aria PARTITION BY KEY(a) PARTITIONS 2;
SELECT * FROM t PARTITION (p1);
a
DROP TABLE t;
@@ -0,0 +1,11 @@
--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;
}

0 comments on commit 9389252

Please sign in to comment.
You can’t perform that action at this time.