=== modified file 'include/mysql/plugin.h' --- include/mysql/plugin.h 2009-06-10 08:59:49 +0000 +++ include/mysql/plugin.h 2010-01-22 18:32:50 +0000 @@ -65,7 +65,7 @@ Plugin API. Common for all plugin types. */ -#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0100 +#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0101 /* The allowable types of plugins @@ -684,6 +684,7 @@ int thd_in_lock_tables(const MYSQL_THD thd); int thd_tablespace_op(const MYSQL_THD thd); +int thd_transactions_enabled(const MYSQL_THD thd); long long thd_test_options(const MYSQL_THD thd, long long test_options); int thd_sql_command(const MYSQL_THD thd); const char *thd_proc_info(MYSQL_THD thd, const char *info); === modified file 'include/mysql/plugin.h.pp' --- include/mysql/plugin.h.pp 2008-06-17 12:27:04 +0000 +++ include/mysql/plugin.h.pp 2010-01-22 17:49:34 +0000 @@ -114,6 +114,7 @@ }; int thd_in_lock_tables(const void* thd); int thd_tablespace_op(const void* thd); +int thd_transactions_enabled(const void* thd); long long thd_test_options(const void* thd, long long test_options); int thd_sql_command(const void* thd); const char *thd_proc_info(void* thd, const char *info); === modified file 'sql/sql_class.cc' --- sql/sql_class.cc 2009-12-08 09:26:11 +0000 +++ sql/sql_class.cc 2010-01-22 17:43:31 +0000 @@ -261,6 +261,12 @@ return test(thd->tablespace_op); } +extern "C" +int thd_transactions_enabled(const THD *thd) +{ + return test(thd->transaction.on); +} + extern "C" const char *set_thd_proc_info(THD *thd, const char *info, @@ -1562,7 +1568,7 @@ static String default_field_term("\t",default_charset_info); sql_exchange::sql_exchange(char *name,bool flag) - :file_name(name), opt_enclosed(0), dumpfile(flag), skip_lines(0) + :file_name(name), opt_enclosed(0), dumpfile(flag), skip_lines(0), transactions(1) { field_term= &default_field_term; enclosed= line_start= &my_empty_string; === modified file 'sql/sql_class.h' --- sql/sql_class.h 2009-12-02 13:49:21 +0000 +++ sql/sql_class.h 2010-01-22 16:44:45 +0000 @@ -2382,6 +2382,7 @@ String *field_term,*enclosed,*line_term,*line_start,*escaped; bool opt_enclosed; bool dumpfile; + bool transactions; ulong skip_lines; CHARSET_INFO *cs; sql_exchange(char *name,bool dumpfile_flag); === modified file 'sql/sql_load.cc' --- sql/sql_load.cc 2010-01-13 10:28:42 +0000 +++ sql/sql_load.cc 2010-01-22 17:57:09 +0000 @@ -162,6 +162,12 @@ ER(WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED)); } + /* + This needs to be done before external_lock + */ + if (!ex->transactions) + ha_enable_transaction(thd, FALSE); + if (open_and_lock_tables(thd, table_list)) DBUG_RETURN(TRUE); if (setup_tables_and_check_access(thd, &thd->lex->select_lex.context, @@ -446,6 +452,9 @@ table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE); table->next_number_field=0; } + /* need to re-enable transactions if disabled */ + if (!ex->transactions) + ha_enable_transaction(thd, TRUE); if (file >= 0) my_close(file,MYF(0)); free_blobs(table); /* if pack_blob was used */ === modified file 'sql/sql_yacc.yy' --- sql/sql_yacc.yy 2010-01-13 10:28:42 +0000 +++ sql/sql_yacc.yy 2010-01-22 19:46:13 +0000 @@ -1452,7 +1452,7 @@ statement sp_suid sp_c_chistics sp_a_chistics sp_chistic sp_c_chistic xa load_data opt_field_or_var_spec fields_or_vars opt_load_data_set_spec - view_replace_or_algorithm view_replace + opt_load_data_transactions view_replace_or_algorithm view_replace view_algorithm view_or_trigger_or_sp_or_event definer_tail no_definer_tail view_suid view_tail view_list_opt view_list view_select @@ -10678,7 +10678,8 @@ } opt_load_data_charset { Lex->exchange->cs= $11; } - opt_field_term opt_line_term opt_ignore_lines opt_field_or_var_spec + opt_load_data_transactions + opt_field_term opt_line_term opt_ignore_lines opt_field_or_var_spec opt_load_data_set_spec {} | FROM MASTER_SYM @@ -10808,6 +10809,11 @@ } ; +opt_load_data_transactions: + /* empty */ {} + | NO_SYM TRANSACTION_SYM { Lex->exchange->transactions = 0; } + ; + opt_load_data_set_spec: /* empty */ {} | SET insert_update_list {} === modified file 'storage/innobase/handler/ha_innodb.cc' --- storage/innobase/handler/ha_innodb.cc 2010-01-13 10:28:42 +0000 +++ storage/innobase/handler/ha_innodb.cc 2010-01-22 17:44:32 +0000 @@ -3864,8 +3864,9 @@ if ((sql_command == SQLCOM_ALTER_TABLE || sql_command == SQLCOM_OPTIMIZE || sql_command == SQLCOM_CREATE_INDEX - || sql_command == SQLCOM_DROP_INDEX) - && num_write_row >= 10000) { + || sql_command == SQLCOM_DROP_INDEX + || !thd_transactions_enabled(user_thd)) + && num_write_row >= 10000) { /* ALTER TABLE is COMMITted at every 10000 copied rows. The IX table lock for the original table has to be re-issued. As this method will be called on a temporary table where the