Commit d35616aa authored by Monty's avatar Monty

Fixed crash in failing instant alter table with partitioned table

MDEV-22649 SIGSEGV in ha_partition::create_partitioning_metadata on ALTER
MDEV-22804 SIGSEGV in ha_partition::create_partitioning_metadata
parent 10b88deb
set @save_alter_algorithm= @@session.alter_algorithm;
SET SESSION alter_algorithm=4;
CREATE TABLE t1(a INT) engine=myisam PARTITION BY RANGE(a) SUBPARTITION BY KEY(a) (PARTITION p0 VALUES LESS THAN (10) (SUBPARTITION s0,SUBPARTITION s1), PARTITION p1 VALUES LESS THAN (20) (SUBPARTITION s2,SUBPARTITION s3));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (`a`)
SUBPARTITION BY KEY (`a`)
(PARTITION `p0` VALUES LESS THAN (10)
(SUBPARTITION `s0` ENGINE = MyISAM,
SUBPARTITION `s1` ENGINE = MyISAM),
PARTITION `p1` VALUES LESS THAN (20)
(SUBPARTITION `s2` ENGINE = MyISAM,
SUBPARTITION `s3` ENGINE = MyISAM))
ALTER TABLE t1 ADD COLUMN c INT;
ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=COPY
DROP table if exists t1;
set @@session.alter_algorithm= @save_alter_algorithm;
CREATE TABLE t1 (a INT) PARTITION BY RANGE(a) SUBPARTITION BY HASH(a) (PARTITION p VALUES LESS THAN (5) (SUBPARTITION sp, SUBPARTITION sp1), PARTITION p1 VALUES LESS THAN MAXVALUE (SUBPARTITION sp2, SUBPARTITION sp3));
ALTER TABLE t1 DROP PARTITION p;
DROP TABLE if exists t1;
#
# General errors with ALTER TABLE and partitions that doesn't have to be run
# on all engines
#
--source include/have_partition.inc
#
# MDEV-22649 SIGSEGV in ha_partition::create_partitioning_metadata on ALTER
#
set @save_alter_algorithm= @@session.alter_algorithm;
SET SESSION alter_algorithm=4;
CREATE TABLE t1(a INT) engine=myisam PARTITION BY RANGE(a) SUBPARTITION BY KEY(a) (PARTITION p0 VALUES LESS THAN (10) (SUBPARTITION s0,SUBPARTITION s1), PARTITION p1 VALUES LESS THAN (20) (SUBPARTITION s2,SUBPARTITION s3));
show create table t1;
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 ADD COLUMN c INT;
DROP table if exists t1;
set @@session.alter_algorithm= @save_alter_algorithm;
#
# MDEV-22804 SIGSEGV in ha_partition::create_partitioning_metadata |
# ERROR 1507 (HY000): Error in list of partitions to DROP
#
CREATE TABLE t1 (a INT) PARTITION BY RANGE(a) SUBPARTITION BY HASH(a) (PARTITION p VALUES LESS THAN (5) (SUBPARTITION sp, SUBPARTITION sp1), PARTITION p1 VALUES LESS THAN MAXVALUE (SUBPARTITION sp2, SUBPARTITION sp3));
ALTER TABLE t1 DROP PARTITION p;
DROP TABLE if exists t1;
......@@ -686,7 +686,9 @@ int ha_partition::create_partitioning_metadata(const char *path,
if (m_part_info)
{
part= m_part_info->partitions.head();
if ((part->engine_type)->create_partitioning_metadata &&
/* part->engine_type may be 0 when we failed to create the partition */
if (part->engine_type &&
(part->engine_type)->create_partitioning_metadata &&
((part->engine_type)->create_partitioning_metadata)(path, old_path,
action_flag))
{
......
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