diff options
author | unknown <monty@mysql.com> | 2004-07-09 02:29:28 +0300 |
---|---|---|
committer | unknown <monty@mysql.com> | 2004-07-09 02:29:28 +0300 |
commit | 53ca595451d53fccd60b1112c444e5278021c1ee (patch) | |
tree | d39c3dfa90aad2f93012b09513ff0ba42c1aa0cb /sql/log_event.cc | |
parent | 661b8165eced19f1943aeee1b166ff10191ab037 (diff) | |
parent | ee9890162e2a2b44f8b09c14b0a22ba9d086df95 (diff) | |
download | mariadb-git-53ca595451d53fccd60b1112c444e5278021c1ee.tar.gz |
Merge with 4.0 to get bug fixes
Build-tools/Bootstrap:
Auto merged
Build-tools/Do-compile:
Auto merged
mysql-test/r/lowercase_table2.result:
Auto merged
mysql-test/r/system_mysql_db.result:
Auto merged
mysql-test/r/system_mysql_db_refs.result:
Auto merged
mysql-test/t/system_mysql_db_fix-master.opt:
Auto merged
mysql-test/t/system_mysql_db.test:
Auto merged
Diffstat (limited to 'sql/log_event.cc')
-rw-r--r-- | sql/log_event.cc | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc index eb86a50b946..8075cd3f4d2 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1696,9 +1696,9 @@ void Load_log_event::set_fields(List<Item> &field_list) int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, bool use_rli_only_for_errors) { + char *load_data_query= 0; thd->db= (char*) rewrite_db(db); DBUG_ASSERT(thd->query == 0); - thd->query= 0; // Should not be needed thd->query_length= 0; // Should not be needed thd->query_error= 0; clear_all_errors(thd, rli); @@ -1749,6 +1749,19 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, { char llbuff[22]; enum enum_duplicates handle_dup; + /* + Make a simplified LOAD DATA INFILE query, for the information of the + user in SHOW PROCESSLIST. Note that db is known in the 'db' column. + */ + if ((load_data_query= (char *) my_alloca(18 + strlen(fname) + 14 + + strlen(tables.real_name) + 8))) + { + thd->query_length= (uint)(strxmov(load_data_query, + "LOAD DATA INFILE '", fname, + "' INTO TABLE `", tables.real_name, + "` <...>", NullS) - load_data_query); + thd->query= load_data_query; + } if (sql_ex.opt_flags & REPLACE_FLAG) handle_dup= DUP_REPLACE; else if (sql_ex.opt_flags & IGNORE_FLAG) @@ -1830,8 +1843,14 @@ Slave: load data infile on table '%s' at log position %s in log \ } thd->net.vio = 0; - thd->db= 0; // prevent db from being freed + VOID(pthread_mutex_lock(&LOCK_thread_count)); + thd->db= 0; + thd->query= 0; + thd->query_length= 0; + VOID(pthread_mutex_unlock(&LOCK_thread_count)); close_thread_tables(thd); + if (load_data_query) + my_afree(load_data_query); if (thd->query_error) { /* this err/sql_errno code is copy-paste from send_error() */ @@ -2846,7 +2865,7 @@ void Create_file_log_event::pack_info(Protocol *protocol) #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) int Create_file_log_event::exec_event(struct st_relay_log_info* rli) { - char fname_buf[FN_REFLEN+10]; + char proc_info[17+FN_REFLEN+10], *fname_buf= proc_info+17; char *p; int fd = -1; IO_CACHE file; @@ -2855,6 +2874,8 @@ int Create_file_log_event::exec_event(struct st_relay_log_info* rli) bzero((char*)&file, sizeof(file)); p = slave_load_file_stem(fname_buf, file_id, server_id); strmov(p, ".info"); // strmov takes less code than memcpy + strnmov(proc_info, "Making temp file ", 17); // no end 0 + thd->proc_info= proc_info; if ((fd = my_open(fname_buf, O_WRONLY|O_CREAT|O_BINARY|O_TRUNC, MYF(MY_WME))) < 0 || init_io_cache(&file, fd, IO_SIZE, WRITE_CACHE, (my_off_t)0, 0, @@ -2898,6 +2919,7 @@ err: end_io_cache(&file); if (fd >= 0) my_close(fd, MYF(0)); + thd->proc_info= 0; return error ? 1 : Log_event::exec_event(rli); } #endif /* defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */ @@ -2995,13 +3017,15 @@ void Append_block_log_event::pack_info(Protocol *protocol) #if defined( HAVE_REPLICATION) && !defined(MYSQL_CLIENT) int Append_block_log_event::exec_event(struct st_relay_log_info* rli) { - char fname[FN_REFLEN+10]; + char proc_info[17+FN_REFLEN+10], *fname= proc_info+17; char *p= slave_load_file_stem(fname, file_id, server_id); int fd; int error = 1; DBUG_ENTER("Append_block_log_event::exec_event"); memcpy(p, ".data", 6); + strnmov(proc_info, "Making temp file ", 17); // no end 0 + thd->proc_info= proc_info; if ((fd = my_open(fname, O_WRONLY|O_APPEND|O_BINARY, MYF(MY_WME))) < 0) { slave_print_error(rli,my_errno, "Error in Append_block event: could not open file '%s'", fname); @@ -3017,6 +3041,7 @@ int Append_block_log_event::exec_event(struct st_relay_log_info* rli) err: if (fd >= 0) my_close(fd, MYF(0)); + thd->proc_info= 0; DBUG_RETURN(error ? error : Log_event::exec_event(rli)); } #endif |