diff options
author | unknown <marty@linux.site> | 2006-04-11 14:06:32 +0200 |
---|---|---|
committer | unknown <marty@linux.site> | 2006-04-11 14:06:32 +0200 |
commit | 6b7e19af4f9cf574bf927fea589582c444d85675 (patch) | |
tree | 7e10edbff33ef8d05401c71fa9505046d3cbe8f8 /sql/sql_table.cc | |
parent | 94c3287616440f01be96c7fa568ad5592faa1cd5 (diff) | |
download | mariadb-git-6b7e19af4f9cf574bf927fea589582c444d85675.tar.gz |
Fixes for fast alter table for ndbcluster
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 2687b64841f..0c08c960785 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -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; |