Commit 23b4ccde authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-4786 merge 10.0-monty -> 10.0

fix simple_rename_or_index_change() to reuse alter_table_manage_keys()
parent 5dd28db2
...@@ -7456,28 +7456,9 @@ simple_rename_or_index_change(THD *thd, TABLE_LIST *table_list, ...@@ -7456,28 +7456,9 @@ simple_rename_or_index_change(THD *thd, TABLE_LIST *table_list,
if (lock_tables(thd, table_list, alter_ctx->tables_opened, 0)) if (lock_tables(thd, table_list, alter_ctx->tables_opened, 0))
DBUG_RETURN(true); DBUG_RETURN(true);
if (keys_onoff == Alter_info::ENABLE) error= alter_table_manage_keys(table,
{ table->file->indexes_are_disabled(),
DEBUG_SYNC(thd,"alter_table_enable_indexes"); keys_onoff);
DBUG_EXECUTE_IF("sleep_alter_enable_indexes", my_sleep(6000000););
error= table->file->ha_enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
}
else if (keys_onoff == Alter_info::DISABLE)
error=table->file->ha_disable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
if (error == HA_ERR_WRONG_COMMAND)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA),
table->file->table_type(),
table->s->db.str, table->s->table_name.str);
error= 0;
}
else if (error > 0)
{
table->file->print_error(error, MYF(0));
error= -1;
}
} }
if (!error && alter_ctx->is_table_renamed()) if (!error && alter_ctx->is_table_renamed())
...@@ -8307,7 +8288,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -8307,7 +8288,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN)) wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN))
goto err_new_table_cleanup; goto err_new_table_cleanup;
THD_STAGE_INFO(thd, stage_manage_keys); THD_STAGE_INFO(thd, stage_manage_keys);
DEBUG_SYNC(thd, "alter_table_manage_keys");
alter_table_manage_keys(table, table->file->indexes_are_disabled(), alter_table_manage_keys(table, table->file->indexes_are_disabled(),
alter_info->keys_onoff); alter_info->keys_onoff);
if (trans_commit_stmt(thd) || trans_commit_implicit(thd)) if (trans_commit_stmt(thd) || trans_commit_implicit(thd))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment