summaryrefslogtreecommitdiff
path: root/storage/xtradb/handler/handler0alter.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2017-05-26 19:32:28 +0400
committerAlexander Barkov <bar@mariadb.org>2017-05-26 19:32:28 +0400
commit9bc32256427373e5bfa78f17c5854ac4e6a2fc31 (patch)
tree748fd55866bcbc4de5eee1c078ac8d2cad5b6fd7 /storage/xtradb/handler/handler0alter.cc
parent77b2f55f61a4e3ba642049a01651c92bfb0a7d9d (diff)
parentca7cf69cb13285585922722063af888b957580ee (diff)
downloadmariadb-git-9bc32256427373e5bfa78f17c5854ac4e6a2fc31.tar.gz
Merge tag 'mariadb-10.2.6' into bb-10.2-ext
Diffstat (limited to 'storage/xtradb/handler/handler0alter.cc')
-rw-r--r--storage/xtradb/handler/handler0alter.cc62
1 files changed, 56 insertions, 6 deletions
diff --git a/storage/xtradb/handler/handler0alter.cc b/storage/xtradb/handler/handler0alter.cc
index 39e7c952f5d..ef8c62849ae 100644
--- a/storage/xtradb/handler/handler0alter.cc
+++ b/storage/xtradb/handler/handler0alter.cc
@@ -3137,7 +3137,7 @@ prepare_inplace_alter_table_dict(
clustered index of the old table, later. */
if (new_clustered
|| !ctx->online
- || user_table->ibd_file_missing
+ || !user_table->is_readable()
|| dict_table_is_discarded(user_table)) {
/* No need to allocate a modification log. */
ut_ad(!ctx->add_index[a]->online_log);
@@ -3557,6 +3557,43 @@ ha_innobase::prepare_inplace_alter_table(
goto func_exit;
}
+ indexed_table = prebuilt->table;
+
+ if (indexed_table->is_readable()) {
+ } else {
+ if (indexed_table->corrupted) {
+ /* Handled below */
+ } else {
+ FilSpace space(indexed_table->space, true);
+
+ if (space()) {
+ String str;
+ const char* engine= table_type();
+ char buf[MAX_FULL_NAME_LEN];
+ ut_format_name(indexed_table->name, TRUE, buf, sizeof(buf));
+
+ push_warning_printf(user_thd, Sql_condition::WARN_LEVEL_WARN,
+ HA_ERR_DECRYPTION_FAILED,
+ "Table %s in file %s is encrypted but encryption service or"
+ " used key_id is not available. "
+ " Can't continue reading table.",
+ buf, space()->chain.start->name);
+
+ my_error(ER_GET_ERRMSG, MYF(0), HA_ERR_DECRYPTION_FAILED, str.c_ptr(), engine);
+ DBUG_RETURN(true);
+ }
+ }
+ }
+
+ if (indexed_table->corrupted
+ || dict_table_get_first_index(indexed_table) == NULL
+ || dict_index_is_corrupted(
+ dict_table_get_first_index(indexed_table))) {
+ /* The clustered index is corrupted. */
+ my_error(ER_CHECK_NO_SUCH_TABLE, MYF(0));
+ DBUG_RETURN(true);
+ }
+
if (ha_alter_info->handler_flags
& Alter_inplace_info::CHANGE_CREATE_OPTION) {
/* Check engine specific table options */
@@ -4209,7 +4246,7 @@ ok_exit:
DBUG_ASSERT(ctx->trx);
DBUG_ASSERT(ctx->prebuilt == prebuilt);
- if (prebuilt->table->ibd_file_missing
+ if (prebuilt->table->file_unreadable
|| dict_table_is_discarded(prebuilt->table)) {
goto all_done;
}
@@ -5231,7 +5268,7 @@ commit_try_rebuild(
/* The new table must inherit the flag from the
"parent" table. */
if (dict_table_is_discarded(user_table)) {
- rebuilt_table->ibd_file_missing = true;
+ rebuilt_table->file_unreadable = true;
rebuilt_table->flags2 |= DICT_TF2_DISCARDED;
}
@@ -5763,9 +5800,9 @@ ha_innobase::commit_inplace_alter_table(
if (ha_alter_info->group_commit_ctx) {
ctx_array = ha_alter_info->group_commit_ctx;
} else {
- ctx_single[0] = ctx0;
- ctx_single[1] = NULL;
- ctx_array = ctx_single;
+ ctx_single[0] = ctx0;
+ ctx_single[1] = NULL;
+ ctx_array = ctx_single;
}
DBUG_ASSERT(ctx0 == ctx_array[0]);
@@ -5794,6 +5831,19 @@ ha_innobase::commit_inplace_alter_table(
= static_cast<ha_innobase_inplace_ctx*>(*pctx);
DBUG_ASSERT(ctx->prebuilt->trx == prebuilt->trx);
+ /* If decryption failed for old table or new table
+ fail here. */
+ if ((ctx->old_table->file_unreadable &&
+ fil_space_get(ctx->old_table->space) != NULL)||
+ (ctx->new_table->file_unreadable &&
+ fil_space_get(ctx->new_table->space) != NULL)) {
+ String str;
+ const char* engine= table_type();
+ get_error_message(HA_ERR_DECRYPTION_FAILED, &str);
+ my_error(ER_GET_ERRMSG, MYF(0), HA_ERR_DECRYPTION_FAILED, str.c_ptr(), engine);
+ DBUG_RETURN(true);
+ }
+
/* Exclusively lock the table, to ensure that no other
transaction is holding locks on the table while we
change the table definition. The MySQL meta-data lock