Backport of revno: 3514
Bug#40181 Made use of tdc_remove_table instead of just setting share->version to 0 to make sure all unused table instances go away as part of CREATE/ALTER TABLE.
This commit is contained in:
parent
58a9857bc5
commit
7d71d71535
@ -65,6 +65,15 @@ show indexes from t1;
|
|||||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||||
t1 1 a 1 a A 1 NULL NULL YES BTREE
|
t1 1 a 1 a A 1 NULL NULL YES BTREE
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
create table t1 (a int)
|
||||||
|
partition by hash (a);
|
||||||
|
create index i on t1 (a);
|
||||||
|
insert into t1 values (1);
|
||||||
|
insert into t1 select * from t1;
|
||||||
|
create index i on t1 (a);
|
||||||
|
ERROR 42000: Duplicate key name 'i'
|
||||||
|
create index i2 on t1 (a);
|
||||||
|
drop table t1;
|
||||||
CREATE TABLE t1 (a INT, FOREIGN KEY (a) REFERENCES t0 (a))
|
CREATE TABLE t1 (a INT, FOREIGN KEY (a) REFERENCES t0 (a))
|
||||||
ENGINE=MyISAM
|
ENGINE=MyISAM
|
||||||
PARTITION BY HASH (a);
|
PARTITION BY HASH (a);
|
||||||
|
@ -74,6 +74,19 @@ analyze table t1;
|
|||||||
show indexes from t1;
|
show indexes from t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#40181: hang if create index
|
||||||
|
#
|
||||||
|
create table t1 (a int)
|
||||||
|
partition by hash (a);
|
||||||
|
create index i on t1 (a);
|
||||||
|
insert into t1 values (1);
|
||||||
|
insert into t1 select * from t1;
|
||||||
|
--error ER_DUP_KEYNAME
|
||||||
|
create index i on t1 (a);
|
||||||
|
create index i2 on t1 (a);
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug#36001: Partitions: spelling and using some error messages
|
# Bug#36001: Partitions: spelling and using some error messages
|
||||||
#
|
#
|
||||||
|
@ -4189,7 +4189,9 @@ bool mysql_unpack_partition(THD *thd,
|
|||||||
*/
|
*/
|
||||||
thd->free_items();
|
thd->free_items();
|
||||||
part_info= thd->work_part_info;
|
part_info= thd->work_part_info;
|
||||||
table->s->version= 0UL;
|
tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED,
|
||||||
|
table->s->db.str,
|
||||||
|
table->s->table_name.str);
|
||||||
*work_part_info_used= true;
|
*work_part_info_used= true;
|
||||||
}
|
}
|
||||||
table->part_info= part_info;
|
table->part_info= part_info;
|
||||||
@ -4482,12 +4484,17 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
We are going to manipulate the partition info on the table object
|
We are going to manipulate the partition info on the table object
|
||||||
so we need to ensure that the data structure of the table object
|
so we need to ensure that the table instances cached and all other
|
||||||
is freed by setting version to 0. table->s->version= 0 forces a
|
instances are properly closed.
|
||||||
flush of the table object in close_thread_tables().
|
|
||||||
*/
|
*/
|
||||||
if (table->part_info)
|
if (table->part_info)
|
||||||
table->s->version= 0L;
|
{
|
||||||
|
pthread_mutex_lock(&LOCK_open);
|
||||||
|
tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED,
|
||||||
|
table->s->db.str,
|
||||||
|
table->s->table_name.str);
|
||||||
|
pthread_mutex_unlock(&LOCK_open);
|
||||||
|
}
|
||||||
|
|
||||||
thd->work_part_info= thd->lex->part_info;
|
thd->work_part_info= thd->lex->part_info;
|
||||||
if (thd->work_part_info &&
|
if (thd->work_part_info &&
|
||||||
@ -6242,7 +6249,9 @@ static int alter_close_tables(ALTER_PARTITION_PARAM_TYPE *lpt)
|
|||||||
alter_partition_lock_handling() and the table is closed
|
alter_partition_lock_handling() and the table is closed
|
||||||
by close_thread_tables() instead.
|
by close_thread_tables() instead.
|
||||||
*/
|
*/
|
||||||
table->s->version= 0;
|
tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED,
|
||||||
|
table->s->db.str,
|
||||||
|
table->s->table_name.str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&LOCK_open);
|
pthread_mutex_unlock(&LOCK_open);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user