1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge 10.2 into 10.3

This commit is contained in:
Marko Mäkelä
2019-01-24 16:14:12 +02:00
53 changed files with 693 additions and 155 deletions

View File

@ -6801,6 +6801,12 @@ static bool fill_alter_inplace_info(THD *thd,
KEY *new_key;
KEY *new_key_end=
ha_alter_info->key_info_buffer + ha_alter_info->key_count;
/*
Primary key index for the new table
*/
const KEY* const new_pk= (ha_alter_info->key_count > 0 &&
is_candidate_key(ha_alter_info->key_info_buffer)) ?
ha_alter_info->key_info_buffer : NULL;
DBUG_PRINT("info", ("index count old: %d new: %d",
table->s->keys, ha_alter_info->key_count));
@ -6877,6 +6883,16 @@ static bool fill_alter_inplace_info(THD *thd,
goto index_changed;
}
/*
Rebuild the index if following condition get satisfied:
(i) Old table doesn't have primary key, new table has it and vice-versa
(ii) Primary key changed to another existing index
*/
if ((new_key == new_pk) !=
((uint) (table_key - table->key_info) == table->s->primary_key))
goto index_changed;
/* Check that key comment is not changed. */
if (table_key->comment.length != new_key->comment.length ||
(table_key->comment.length &&