diff options
author | Mattias Jonsson <mattias.jonsson@oracle.com> | 2010-11-15 16:32:21 +0100 |
---|---|---|
committer | Mattias Jonsson <mattias.jonsson@oracle.com> | 2010-11-15 16:32:21 +0100 |
commit | 027d647521ff8646a7e80a505db77d2062cd78d7 (patch) | |
tree | 2e93f047d8b32c512639858c5250f26d4fd858aa /sql/sql_partition.cc | |
parent | 1b583fa5da71a764dd66ad8b3668d7c75b122444 (diff) | |
parent | dd1d7ff161e22d697eec3c40893d380b0c0ef0bb (diff) | |
download | mariadb-git-027d647521ff8646a7e80a505db77d2062cd78d7.tar.gz |
merge
Diffstat (limited to 'sql/sql_partition.cc')
-rw-r--r-- | sql/sql_partition.cc | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 702c3d99fda..d6f05bf5407 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -5935,6 +5935,12 @@ static void alter_partition_lock_handling(ALTER_PARTITION_PARAM_TYPE *lpt) if (lpt->thd->locked_tables) { /* + Close the table if open, to remove/destroy the already altered + table->part_info object, so that it is not reused. + */ + if (lpt->table->db_stat) + abort_and_upgrade_lock_and_close_table(lpt); + /* When we have the table locked, it is necessary to reopen the table since all table objects were closed and removed as part of the ALTER TABLE of partitioning structure. @@ -6436,7 +6442,20 @@ uint fast_alter_partition_table(THD *thd, TABLE *table, table, table_list, FALSE, NULL, written_bin_log)); err: - close_thread_tables(thd); + if (thd->locked_tables) + { + /* + table->part_info was altered in prep_alter_part_table and must be + destroyed and recreated, since otherwise it will be reused, since + we are under LOCK TABLE. + */ + alter_partition_lock_handling(lpt); + } + else + { + /* Force the table to be closed to avoid reuse of the table->part_info */ + close_thread_tables(thd); + } DBUG_RETURN(TRUE); } #endif |