diff options
Diffstat (limited to 'storage/innobase/handler/handler0alter.cc')
-rw-r--r-- | storage/innobase/handler/handler0alter.cc | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index a8cf53b5033..cb7d0455290 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2005, 2018, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2005, 2019, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2013, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under @@ -13,7 +13,7 @@ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA *****************************************************************************/ @@ -1019,6 +1019,7 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx { UT_DELETE(m_stage); if (instant_table) { + ut_ad(!instant_table->id); while (dict_index_t* index = UT_LIST_GET_LAST(instant_table->indexes)) { UT_LIST_REMOVE(instant_table->indexes, index); @@ -1028,6 +1029,9 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx for (unsigned i = old_n_v_cols; i--; ) { UT_DELETE(old_v_cols[i].v_indexes); } + if (instant_table->fts) { + fts_free(instant_table); + } dict_mem_table_free(instant_table); } mem_heap_free(heap); @@ -1127,6 +1131,23 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx const TABLE* table); /*!< in: MySQL table that is being altered */ + /** Share context between partitions. + @param[in] ctx context from another partition of the table */ + void set_shared_data(const inplace_alter_handler_ctx& ctx) + { + if (add_autoinc != ULINT_UNDEFINED) { + const ha_innobase_inplace_ctx& ha_ctx = + static_cast<const ha_innobase_inplace_ctx&> + (ctx); + /* When adding an AUTO_INCREMENT column to a + partitioned InnoDB table, we must share the + sequence for all partitions. */ + ut_ad(ha_ctx.add_autoinc == add_autoinc); + ut_ad(ha_ctx.sequence.last()); + sequence = ha_ctx.sequence; + } + } + private: // Disable copying ha_innobase_inplace_ctx(const ha_innobase_inplace_ctx&); @@ -6099,7 +6120,7 @@ prepare_inplace_alter_table_dict( (ha_alter_info->handler_ctx); DBUG_ASSERT((ctx->add_autoinc != ULINT_UNDEFINED) - == (ctx->sequence.m_max_value > 0)); + == (ctx->sequence.max_value() > 0)); DBUG_ASSERT(!ctx->num_to_drop_index == !ctx->drop_index); DBUG_ASSERT(!ctx->num_to_drop_fk == !ctx->drop_fk); DBUG_ASSERT(!add_fts_doc_id || add_fts_doc_id_idx); @@ -8255,6 +8276,8 @@ ha_innobase::inplace_alter_table( DBUG_ENTER("inplace_alter_table"); DBUG_ASSERT(!srv_read_only_mode); ut_ad(!sync_check_iterate(sync_check())); + ut_ad(!rw_lock_own_flagged(&dict_sys.latch, + RW_LOCK_FLAG_X | RW_LOCK_FLAG_S)); DEBUG_SYNC(m_user_thd, "innodb_inplace_alter_table_enter"); |