Commit 1e651721 authored by unknown's avatar unknown

Bug #10694 LOAD DATA FROM INFILE fails with 'Out of operation records'

parent 0870daca
...@@ -114,6 +114,10 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, ...@@ -114,6 +114,10 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
MYF(0)); MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
/*
This needs to be done before external_lock
*/
ha_enable_transaction(thd, FALSE);
if (!(table = open_ltable(thd,table_list,lock_type))) if (!(table = open_ltable(thd,table_list,lock_type)))
DBUG_RETURN(-1); DBUG_RETURN(-1);
transactional_table= table->file->has_transactions(); transactional_table= table->file->has_transactions();
...@@ -273,7 +277,6 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, ...@@ -273,7 +277,6 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
if (ignore || if (ignore ||
handle_duplicates == DUP_REPLACE) handle_duplicates == DUP_REPLACE)
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY); table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
ha_enable_transaction(thd, FALSE);
table->file->start_bulk_insert((ha_rows) 0); table->file->start_bulk_insert((ha_rows) 0);
table->copy_blobs=1; table->copy_blobs=1;
if (!field_term->length() && !enclosed->length()) if (!field_term->length() && !enclosed->length())
...@@ -284,10 +287,10 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, ...@@ -284,10 +287,10 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
skip_lines); skip_lines);
if (table->file->end_bulk_insert()) if (table->file->end_bulk_insert())
error=1; /* purecov: inspected */ error=1; /* purecov: inspected */
ha_enable_transaction(thd, TRUE);
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
table->next_number_field=0; table->next_number_field=0;
} }
ha_enable_transaction(thd, TRUE);
if (file >= 0) if (file >= 0)
my_close(file,MYF(0)); my_close(file,MYF(0));
free_blobs(table); /* if pack_blob was used */ free_blobs(table); /* if pack_blob was used */
......
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