diff options
Diffstat (limited to 'storage/innobase/handler')
| -rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 27 | ||||
| -rw-r--r-- | storage/innobase/handler/handler0alter.cc | 51 |
2 files changed, 35 insertions, 43 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index e8b1ea7350e..2236abf593c 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2017, MariaDB Corporation. +Copyright (c) 2013, 2018, MariaDB Corporation. Copyright (c) 2008, 2009 Google Inc. Copyright (c) 2009, Percona Inc. Copyright (c) 2012, Facebook Inc. @@ -2819,13 +2819,17 @@ check_trx_exists( return(trx); } -/************************************************************************* -Gets current trx. */ -trx_t* -innobase_get_trx() +/** + Gets current trx. + + This function may be called during InnoDB initialisation, when + innodb_hton_ptr->slot is not yet set to meaningful value. +*/ + +trx_t *current_trx() { THD *thd=current_thd; - if (likely(thd != 0)) { + if (likely(thd != 0) && innodb_hton_ptr->slot != HA_SLOT_UNDEF) { trx_t*& trx = thd_to_trx(thd); return(trx); } else { @@ -21981,7 +21985,8 @@ const char* BUG_REPORT_MSG = "Submit a detailed bug report to https://jira.mariadb.org/"; const char* FORCE_RECOVERY_MSG = - "Please refer to " REFMAN "forcing-innodb-recovery.html" + "Please refer to " + "https://mariadb.com/kb/en/library/xtradbinnodb-recovery-modes/" " for information about forcing recovery."; const char* ERROR_CREATING_MSG = @@ -21989,17 +21994,17 @@ const char* ERROR_CREATING_MSG = const char* OPERATING_SYSTEM_ERROR_MSG = "Some operating system error numbers are described at" - " " REFMAN "operating-system-error-codes.html"; + " https://mariadb.com/kb/en/library/operating-system-error-codes/"; const char* FOREIGN_KEY_CONSTRAINTS_MSG = - "Please refer to " REFMAN "innodb-foreign-key-constraints.html" + "Please refer to https://mariadb.com/kb/en/library/foreign-keys/" " for correct foreign key definition."; const char* SET_TRANSACTION_MSG = - "Please refer to " REFMAN "set-transaction.html"; + "Please refer to https://mariadb.com/kb/en/library/set-transaction/"; const char* INNODB_PARAMETERS_MSG = - "Please refer to " REFMAN "innodb-parameters.html"; + "Please refer to https://mariadb.com/kb/en/library/xtradbinnodb-server-system-variables/"; /********************************************************************** Converts an identifier from my_charset_filename to UTF-8 charset. diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index a8cb749c5b1..8c1ba192b17 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -1177,6 +1177,7 @@ next_column: /* If the table already contains fulltext indexes, refuse to rebuild the table natively altogether. */ if (m_prebuilt->table->fts) { +cannot_create_many_fulltext_index: ha_alter_info->unsupported_reason = innobase_get_err_msg( ER_INNODB_FT_LIMIT); DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); @@ -1206,6 +1207,7 @@ next_column: We could also do ADD SPATIAL INDEX by implementing row_log_apply() for it. */ + bool add_fulltext = false; for (uint i = 0; i < ha_alter_info->index_add_count; i++) { const KEY* key = @@ -1217,16 +1219,18 @@ next_column: | HA_PACK_KEY | HA_GENERATED_KEY | HA_BINARY_PACK_KEY))); + if (add_fulltext) { + goto cannot_create_many_fulltext_index; + } + add_fulltext = true; ha_alter_info->unsupported_reason = innobase_get_err_msg( ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FTS); online = false; - break; } - if (key->flags & HA_SPATIAL) { + if (online && (key->flags & HA_SPATIAL)) { ha_alter_info->unsupported_reason = innobase_get_err_msg( ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS); online = false; - break; } } } @@ -5326,35 +5330,18 @@ new_clustered_failed: ctx->prepare_instant(); } - if (!ctx->is_instant()) { - if (num_fts_index > 1) { - my_error(ER_INNODB_FT_LIMIT, MYF(0)); - goto error_handled; - } - - if (!ctx->online) { - /* This is not an online operation (LOCK=NONE). */ - } else if (ctx->add_autoinc == ULINT_UNDEFINED - && num_fts_index == 0 - && (!innobase_need_rebuild(ha_alter_info, old_table) - || !innobase_fulltext_exist(altered_table))) { - /* InnoDB can perform an online operation - (LOCK=NONE). */ - } else { - size_t query_length; - /* This should have been blocked in - check_if_supported_inplace_alter(). */ - ut_ad(0); - my_error(ER_NOT_SUPPORTED_YET, MYF(0), - innobase_get_stmt_unsafe( - ctx->prebuilt->trx->mysql_thd, - &query_length)); - goto error_handled; - } - } - if (ctx->need_rebuild()) { not_instant_add_column: + DBUG_ASSERT(ctx->need_rebuild()); + DBUG_ASSERT(!ctx->is_instant()); + DBUG_ASSERT(num_fts_index <= 1); + DBUG_ASSERT(!ctx->online || num_fts_index == 0); + DBUG_ASSERT(!ctx->online + || ctx->add_autoinc == ULINT_UNDEFINED); + DBUG_ASSERT(!ctx->online + || !innobase_need_rebuild(ha_alter_info, old_table) + || !innobase_fulltext_exist(altered_table)); + uint32_t key_id = FIL_DEFAULT_ENCRYPTION_KEY; fil_encryption_t mode = FIL_ENCRYPTION_DEFAULT; @@ -5454,7 +5441,7 @@ new_table_failed: ut_ad(index->trx_id == ctx->trx->id); if (index->type & DICT_FTS) { - DBUG_ASSERT(num_fts_index); + DBUG_ASSERT(num_fts_index == 1); DBUG_ASSERT(!fts_index); DBUG_ASSERT(index->type == DICT_FTS); fts_index = ctx->add_index[a]; @@ -5539,7 +5526,7 @@ error_handling_drop_uncached: /* If ADD INDEX with LOCK=NONE has been requested, allocate a modification log. */ if (index->type & DICT_FTS) { - DBUG_ASSERT(num_fts_index); + DBUG_ASSERT(num_fts_index == 1); DBUG_ASSERT(!fts_index); DBUG_ASSERT(index->type == DICT_FTS); fts_index = ctx->add_index[a]; |
