mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fixes for fast alter table for ndbcluster
This commit is contained in:
@ -347,7 +347,7 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
|
||||
lpt->create_info, lpt->new_create_list, lpt->key_count,
|
||||
lpt->key_info_buffer, lpt->table->file)) ||
|
||||
((flags & WFRM_CREATE_HANDLER_FILES) &&
|
||||
lpt->table->file->create_handler_files(path)))
|
||||
lpt->table->file->create_handler_files(path, lpt->create_info)))
|
||||
{
|
||||
error= 1;
|
||||
goto end;
|
||||
@ -3964,6 +3964,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||
char tmp_name[80],old_name[32],new_name_buff[FN_REFLEN];
|
||||
char new_alias_buff[FN_REFLEN], *table_name, *db, *new_alias, *alias;
|
||||
char index_file[FN_REFLEN], data_file[FN_REFLEN];
|
||||
char path[FN_REFLEN];
|
||||
char reg_path[FN_REFLEN+1];
|
||||
ha_rows copied,deleted;
|
||||
ulonglong next_insert_id;
|
||||
@ -4000,6 +4001,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||
if (!new_db || !my_strcasecmp(table_alias_charset, new_db, db))
|
||||
new_db= db;
|
||||
build_table_filename(reg_path, sizeof(reg_path), db, table_name, reg_ext);
|
||||
build_table_filename(path, sizeof(path), db, table_name, "");
|
||||
|
||||
used_fields=create_info->used_fields;
|
||||
|
||||
@ -4773,6 +4775,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||
KEY_PART_INFO *part_end;
|
||||
DBUG_PRINT("info", ("No new_table, checking add/drop index"));
|
||||
|
||||
table->file->prepare_for_alter();
|
||||
if (index_add_count)
|
||||
{
|
||||
#ifdef XXX_TO_BE_DONE_LATER_BY_WL3020_AND_WL1892
|
||||
@ -4788,7 +4791,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||
error= (mysql_create_frm(thd, reg_path, db, table_name,
|
||||
create_info, prepared_create_list, key_count,
|
||||
key_info_buffer, table->file) ||
|
||||
table->file->create_handler_files(reg_path));
|
||||
table->file->create_handler_files(path, create_info));
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
if (error)
|
||||
goto err;
|
||||
@ -4834,7 +4837,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||
error= (mysql_create_frm(thd, reg_path, db, table_name,
|
||||
create_info, prepared_create_list, key_count,
|
||||
key_info_buffer, table->file) ||
|
||||
table->file->create_handler_files(reg_path));
|
||||
table->file->create_handler_files(path, create_info));
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
if (error)
|
||||
goto err;
|
||||
@ -4904,19 +4907,16 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||
}
|
||||
/*end of if (index_drop_count)*/
|
||||
|
||||
if (index_add_count || index_drop_count)
|
||||
{
|
||||
/*
|
||||
The final .frm file is already created as a temporary file
|
||||
and will be renamed to the original table name later.
|
||||
*/
|
||||
/*
|
||||
The final .frm file is already created as a temporary file
|
||||
and will be renamed to the original table name later.
|
||||
*/
|
||||
|
||||
/* Need to commit before a table is unlocked (NDB requirement). */
|
||||
DBUG_PRINT("info", ("Committing after add/drop index"));
|
||||
if (ha_commit_stmt(thd) || ha_commit(thd))
|
||||
goto err;
|
||||
committed= 1;
|
||||
}
|
||||
/* Need to commit before a table is unlocked (NDB requirement). */
|
||||
DBUG_PRINT("info", ("Committing before unlocking table"));
|
||||
if (ha_commit_stmt(thd) || ha_commit(thd))
|
||||
goto err;
|
||||
committed= 1;
|
||||
}
|
||||
/*end of if (! new_table) for add/drop index*/
|
||||
|
||||
@ -5061,7 +5061,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
}
|
||||
/* Tell the handler that a new frm file is in place. */
|
||||
if (table->file->create_handler_files(reg_path))
|
||||
if (table->file->create_handler_files(path, create_info))
|
||||
{
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
goto err;
|
||||
|
Reference in New Issue
Block a user