MDEV-15456 Server crashes upon adding or dropping a partition in ALTER under LOCK TABLE after ER_SAME_NAME_PARTITION

followup for bcb36ee21e2

move reopening before trans_commit_stmt(thd);
This commit is contained in:
Sergei Golubchik 2018-04-25 13:20:44 +02:00
parent 03da1253af
commit 619afb151b
6 changed files with 8 additions and 7 deletions

View File

@ -39,7 +39,7 @@ DROP TABLE t1;
#
# MDEV-15456 Server crashes upon adding or dropping a partition in ALTER under LOCK TABLE after ER_SAME_NAME_PARTITION
#
create table t1 (i int) partition by range(i) (partition p0 values less than (10));
--eval create table t1 (i int) engine=$engine partition by range(i) (partition p0 values less than (10))
lock table t1 write;
--error ER_SAME_NAME_PARTITION
alter table t1 add partition (partition p0 values less than (20));

View File

@ -47,7 +47,7 @@ PARTITION p3 VALUES IN (4,5,6)
);
ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition
DROP TABLE t1;
create table t1 (i int) partition by range(i) (partition p0 values less than (10));
create table t1 (i int) engine=InnoDB partition by range(i) (partition p0 values less than (10));
lock table t1 write;
alter table t1 add partition (partition p0 values less than (20));
ERROR HY000: Duplicate partition name p0

View File

@ -69,7 +69,7 @@ PARTITION p3 VALUES IN (4,5,6)
);
ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition
DROP TABLE t1;
create table t1 (i int) partition by range(i) (partition p0 values less than (10));
create table t1 (i int) engine=Aria partition by range(i) (partition p0 values less than (10));
lock table t1 write;
alter table t1 add partition (partition p0 values less than (20));
ERROR HY000: Duplicate partition name p0

View File

@ -42,7 +42,7 @@ PARTITION p3 VALUES IN (4,5,6)
);
ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition
DROP TABLE t1;
create table t1 (i int) partition by range(i) (partition p0 values less than (10));
create table t1 (i int) engine=MyISAM partition by range(i) (partition p0 values less than (10));
lock table t1 write;
alter table t1 add partition (partition p0 values less than (20));
ERROR HY000: Duplicate partition name p0

View File

@ -952,10 +952,7 @@ void close_thread_tables(THD *thd)
we will exit this function a few lines below.
*/
if (! thd->lex->requires_prelocking())
{
thd->locked_tables_list.reopen_tables(thd, true);
DBUG_VOID_RETURN;
}
/*
We are in the top-level statement of a prelocked statement,

View File

@ -5136,6 +5136,10 @@ finish:
lex->unit.cleanup();
/* close/reopen tables that were marked to need reopen under LOCK TABLES */
if (! thd->lex->requires_prelocking())
thd->locked_tables_list.reopen_tables(thd, true);
if (! thd->in_sub_stmt)
{
if (thd->killed != NOT_KILLED)