Browse files


Problem :
Issue-1: Rename partition [mysql_rename_partitions] fails as there
are open references to dict_table_t. The issue here is in
alter_close_tables() we are not closing other instances of the same
table opened by the thread.
5.5 => Closes instances for old table [No issue]
5.6 => Fails to close table. [Needs to be fixed]
5.7 => Handled along with WL#4807 [No issue]

Issue-2: Failure handling causes crash
In handle_alter_part_error()->close_thread_table() we are doing lock
removal for current table but resetting the first table in thrd->tables.
For a case when there are multiple open instances for the same table
in current thread(lock table ...) it causes the issue. In debug mode it
immediately hits assert and in release mode it crashes later as the
current table is not closed.

Solution :
Issue - 1: Close other tables in close_thread_table() - 5.6 only
Issue - 2: Debug assert that current table is first one in table list
handle_alter_part_end- 5.7
handle_alter_part_error- 5.6

Reviewed-by: Mattias Jonsson <>

RB: 9296
  • Loading branch information...
Debarun Banerjee
Debarun Banerjee committed Jun 19, 2015
1 parent 3c73903 commit 6b0e6683416dc6f8274a460bd2512e7b037ec75f
Showing with 6 additions and 0 deletions.
  1. +6 −0 sql/
@@ -6688,6 +6688,9 @@ static int alter_close_table(ALTER_PARTITION_PARAM_TYPE *lpt)
/* Remove other instances of the table before dropping partitions */
close_all_tables_for_name(lpt->thd, lpt->table->s, false, lpt->table);
if (lpt->table->db_stat)
mysql_lock_remove(lpt->thd, lpt->thd->lock, lpt->table);
@@ -6740,6 +6743,9 @@ void handle_alter_part_error(ALTER_PARTITION_PARAM_TYPE *lpt,
/* Assert that the current table is the first in list of open tables */
DBUG_ASSERT(thd->open_tables == table);
Make sure that the table is unlocked, closed and removed from
the table cache.

0 comments on commit 6b0e668

Please sign in to comment.