1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

BUG#27216817: INNODB: FAILING ASSERTION:

PREBUILT->TABLE->N_MYSQL_HANDLES_OPENED == 1

ANALYSIS:
=========

Adding unique index to a InnoDB table which is locked as
mutliple instances may trigger an InnoDB assert.

When we add a primary key or an unique index, we need to
drop the original table and rebuild all indexes. InnoDB
expects that only the instance of the table that is being
rebuilt, is open during the process. In the current
scenario we have opened multiple instances of the table.
This triggers an assert during table rebuild.
'Locked_tables_list' encapsulates a list of all
instances of tables locked by LOCK TABLES statement.

FIX:
===
We are now temporarily closing all the instances of the
table except the one which is being altered and later
reopen them via Locked_tables_list::reopen_tables().
This commit is contained in:
Nisha Gopalakrishnan
2018-02-26 14:37:39 +05:30
parent 873f8c25b6
commit c0b4d74b52
7 changed files with 43 additions and 20 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -6512,7 +6512,7 @@ static void alter_partition_lock_handling(ALTER_PARTITION_PARAM_TYPE *lpt)
THD *thd= lpt->thd;
if (lpt->old_table)
close_all_tables_for_name(thd, lpt->old_table->s, FALSE);
close_all_tables_for_name(thd, lpt->old_table->s, FALSE, NULL);
if (lpt->table)
{
/*
@ -6549,7 +6549,7 @@ static int alter_close_tables(ALTER_PARTITION_PARAM_TYPE *lpt, bool close_old)
}
if (close_old && lpt->old_table)
{
close_all_tables_for_name(lpt->thd, lpt->old_table->s, FALSE);
close_all_tables_for_name(lpt->thd, lpt->old_table->s, FALSE, NULL);
lpt->old_table= 0;
}
DBUG_RETURN(0);