mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
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:
@@ -4189,7 +4189,9 @@ bool mysql_unpack_partition(THD *thd,
|
||||
*/
|
||||
thd->free_items();
|
||||
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;
|
||||
}
|
||||
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
|
||||
so we need to ensure that the data structure of the table object
|
||||
is freed by setting version to 0. table->s->version= 0 forces a
|
||||
flush of the table object in close_thread_tables().
|
||||
so we need to ensure that the table instances cached and all other
|
||||
instances are properly closed.
|
||||
*/
|
||||
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;
|
||||
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
|
||||
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);
|
||||
|
Reference in New Issue
Block a user