mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into bodhi.local:/opt/local/work/mysql-5.1-runtime-merge
This commit is contained in:
@@ -4964,7 +4964,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||
char path[FN_REFLEN];
|
||||
char reg_path[FN_REFLEN+1];
|
||||
ha_rows copied,deleted;
|
||||
ulonglong next_insert_id;
|
||||
uint db_create_options, used_fields;
|
||||
handlerton *old_db_type, *new_db_type;
|
||||
HA_CREATE_INFO *create_info;
|
||||
@@ -5784,7 +5783,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||
thd->count_cuted_fields= CHECK_FIELD_WARN; // calc cuted fields
|
||||
thd->cuted_fields=0L;
|
||||
thd->proc_info="copy to tmp table";
|
||||
next_insert_id=thd->next_insert_id; // Remember for logging
|
||||
copied=deleted=0;
|
||||
if (new_table && !(new_table->file->ha_table_flags() & HA_NO_COPY_ON_ALTER))
|
||||
{
|
||||
@@ -5794,7 +5792,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||
error=copy_data_between_tables(table, new_table, create_list, ignore,
|
||||
order_num, order, &copied, &deleted);
|
||||
}
|
||||
thd->last_insert_id=next_insert_id; // Needed for correct log
|
||||
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
|
||||
|
||||
/* If we did not need to copy, we might still need to add/drop indexes. */
|
||||
@@ -6223,6 +6220,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
|
||||
ha_rows examined_rows;
|
||||
bool auto_increment_field_copied= 0;
|
||||
ulong save_sql_mode;
|
||||
ulonglong prev_insert_id;
|
||||
DBUG_ENTER("copy_data_between_tables");
|
||||
|
||||
/*
|
||||
@@ -6328,6 +6326,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
|
||||
{
|
||||
copy_ptr->do_copy(copy_ptr);
|
||||
}
|
||||
prev_insert_id= to->file->next_insert_id;
|
||||
if ((error=to->file->ha_write_row((byte*) to->record[0])))
|
||||
{
|
||||
if (!ignore ||
|
||||
@@ -6351,7 +6350,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
|
||||
to->file->print_error(error,MYF(0));
|
||||
break;
|
||||
}
|
||||
to->file->restore_auto_increment();
|
||||
to->file->restore_auto_increment(prev_insert_id);
|
||||
delete_count++;
|
||||
}
|
||||
else
|
||||
@@ -6385,6 +6384,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
|
||||
free_io_cache(from);
|
||||
*copied= found_count;
|
||||
*deleted=delete_count;
|
||||
to->file->ha_release_auto_increment();
|
||||
if (to->file->ha_external_lock(thd,F_UNLCK))
|
||||
error=1;
|
||||
DBUG_RETURN(error > 0 ? -1 : 0);
|
||||
|
||||
Reference in New Issue
Block a user