MDEV-14696 Server crashes in in prep_alter_part_table on 2nd execution of PS.
The thd->lex->part_info should be kept intact during PS execution. Or the second execution gets that modified part_info. Let's modify ths->work_part_info instead.
This commit is contained in:
parent
c4a908cb56
commit
6b4a4a85a7
@ -2634,3 +2634,14 @@ alter table t1 drop partition if exists p5;
|
|||||||
Warnings:
|
Warnings:
|
||||||
Note 1507 Error in list of partitions to DROP
|
Note 1507 Error in list of partitions to DROP
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (a INT) ENGINE=MyISAM PARTITION BY RANGE(a) (PARTITION p1 VALUES LESS THAN (0));
|
||||||
|
ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES LESS THAN (1));
|
||||||
|
PREPARE stmt FROM 'ALTER TABLE t1 ADD PARTITION IF NOT EXISTS (PARTITION p2 VALUES LESS THAN (2))';
|
||||||
|
EXECUTE stmt;
|
||||||
|
Warnings:
|
||||||
|
Note 1517 Duplicate partition name p2
|
||||||
|
EXECUTE stmt;
|
||||||
|
Warnings:
|
||||||
|
Note 1517 Duplicate partition name p2
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
DROP TABLE t1;
|
||||||
|
@ -2884,3 +2884,16 @@ alter table t1 drop partition if exists p5;
|
|||||||
|
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# MDEV-14696 Server crashes in in prep_alter_part_table on 2nd execution of PS.
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a INT) ENGINE=MyISAM PARTITION BY RANGE(a) (PARTITION p1 VALUES LESS THAN (0));
|
||||||
|
ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES LESS THAN (1));
|
||||||
|
PREPARE stmt FROM 'ALTER TABLE t1 ADD PARTITION IF NOT EXISTS (PARTITION p2 VALUES LESS THAN (2))';
|
||||||
|
EXECUTE stmt;
|
||||||
|
EXECUTE stmt;
|
||||||
|
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
@ -4713,7 +4713,12 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
|
|||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
thd->work_part_info= thd->lex->part_info;
|
/*
|
||||||
|
One of these is done in handle_if_exists_option():
|
||||||
|
thd->work_part_info= thd->lex->part_info;
|
||||||
|
or
|
||||||
|
thd->work_part_info= NULL;
|
||||||
|
*/
|
||||||
|
|
||||||
if (thd->work_part_info &&
|
if (thd->work_part_info &&
|
||||||
!(thd->work_part_info= thd->work_part_info->get_clone()))
|
!(thd->work_part_info= thd->work_part_info->get_clone()))
|
||||||
|
@ -5997,6 +5997,7 @@ remove_key_no_warn:
|
|||||||
|
|
||||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||||
partition_info *tab_part_info= table->part_info;
|
partition_info *tab_part_info= table->part_info;
|
||||||
|
thd->work_part_info= thd->lex->part_info;
|
||||||
if (tab_part_info && thd->lex->check_exists)
|
if (tab_part_info && thd->lex->check_exists)
|
||||||
{
|
{
|
||||||
/* ALTER TABLE ADD PARTITION IF NOT EXISTS */
|
/* ALTER TABLE ADD PARTITION IF NOT EXISTS */
|
||||||
@ -6015,7 +6016,7 @@ remove_key_no_warn:
|
|||||||
ER_SAME_NAME_PARTITION, ER(ER_SAME_NAME_PARTITION),
|
ER_SAME_NAME_PARTITION, ER(ER_SAME_NAME_PARTITION),
|
||||||
pe->partition_name);
|
pe->partition_name);
|
||||||
alter_info->flags&= ~Alter_info::ALTER_ADD_PARTITION;
|
alter_info->flags&= ~Alter_info::ALTER_ADD_PARTITION;
|
||||||
thd->lex->part_info= NULL;
|
thd->work_part_info= NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user