summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc20
1 files changed, 13 insertions, 7 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index e147c5247fb..7d73ed83beb 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -2300,7 +2300,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
for (table= tables; table; table= table->next_local)
{
bool is_trans= 0;
- bool table_creation_was_logged= 1;
+ bool table_creation_was_logged= 0;
LEX_CSTRING db= table->db;
handlerton *table_type= 0;
@@ -6536,10 +6536,11 @@ static int compare_uint(const uint *s, const uint *t)
return (*s < *t) ? -1 : ((*s > *t) ? 1 : 0);
}
-enum class Compare_keys
+enum class Compare_keys : uint32_t
{
Equal,
EqualButKeyPartLength,
+ EqualButComment,
NotEqual
};
@@ -6623,11 +6624,12 @@ Compare_keys compare_keys_but_name(const KEY *table_key, const KEY *new_key,
return Compare_keys::NotEqual;
/* Check that key comment is not changed. */
- if (table_key->comment.length != new_key->comment.length ||
- (table_key->comment.length &&
- memcmp(table_key->comment.str, new_key->comment.str,
- table_key->comment.length) != 0))
- return Compare_keys::NotEqual;
+ if (cmp(table_key->comment, new_key->comment) != 0)
+ {
+ if (result != Compare_keys::Equal)
+ return Compare_keys::NotEqual;
+ result= Compare_keys::EqualButComment;
+ }
return result;
}
@@ -7017,6 +7019,9 @@ static bool fill_alter_inplace_info(THD *thd, TABLE *table, bool varchar,
case Compare_keys::EqualButKeyPartLength:
ha_alter_info->handler_flags|= ALTER_COLUMN_INDEX_LENGTH;
continue;
+ case Compare_keys::EqualButComment:
+ ha_alter_info->handler_flags|= ALTER_CHANGE_INDEX_COMMENT;
+ continue;
case Compare_keys::NotEqual:
break;
}
@@ -7678,6 +7683,7 @@ static bool mysql_inplace_alter_table(THD *thd,
if (res)
goto rollback;
+ DEBUG_SYNC(thd, "alter_table_inplace_before_lock_upgrade");
// Upgrade to EXCLUSIVE before commit.
if (wait_while_table_is_used(thd, table, HA_EXTRA_PREPARE_FOR_RENAME))
goto rollback;