mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge with 4.1
This commit is contained in:
@@ -2422,9 +2422,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);
|
||||
@@ -2476,6 +2476,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)
|
||||
@@ -2557,9 +2570,14 @@ Slave: load data infile on table '%s' at log position %s in log \
|
||||
}
|
||||
|
||||
thd->net.vio = 0;
|
||||
/* Same reason as in Query_log_event::exec_event() */
|
||||
thd->db= thd->catalog= 0;
|
||||
VOID(pthread_mutex_lock(&LOCK_thread_count));
|
||||
thd->db= thd->catalog= 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() */
|
||||
@@ -3114,17 +3132,18 @@ void User_var_log_event::print(FILE* file, bool short_form, LAST_EVENT_INFO* las
|
||||
> the string constant is still unescaped according to SJIS, not
|
||||
> according to UCS2.
|
||||
*/
|
||||
char *p, *q;
|
||||
if (!(p= (char *)my_alloca(2*val_len+1+2))) // 2 hex digits per byte
|
||||
char *hex_str;
|
||||
CHARSET_INFO *cs;
|
||||
|
||||
if (!(hex_str= (char *)my_alloca(2*val_len+1+2))) // 2 hex digits / byte
|
||||
break; // no error, as we are 'void'
|
||||
str_to_hex(p, val, val_len);
|
||||
str_to_hex(hex_str, val, val_len);
|
||||
/*
|
||||
For proper behaviour when mysqlbinlog|mysql, we need to explicitely
|
||||
specify the variable's collation. It will however cause problems when
|
||||
people want to mysqlbinlog|mysql into another server not supporting the
|
||||
character set. But there's not much to do about this and it's unlikely.
|
||||
*/
|
||||
CHARSET_INFO *cs;
|
||||
if (!(cs= get_charset(charset_number, MYF(0))))
|
||||
/*
|
||||
Generate an unusable command (=> syntax error) is probably the best
|
||||
@@ -3132,8 +3151,8 @@ void User_var_log_event::print(FILE* file, bool short_form, LAST_EVENT_INFO* las
|
||||
*/
|
||||
fprintf(file, ":=???;\n");
|
||||
else
|
||||
fprintf(file, ":=_%s %s COLLATE %s;\n", cs->csname, p, cs->name);
|
||||
my_afree(p);
|
||||
fprintf(file, ":=_%s %s COLLATE %s;\n", cs->csname, hex_str, cs->name);
|
||||
my_afree(hex_str);
|
||||
}
|
||||
break;
|
||||
case ROW_RESULT:
|
||||
@@ -3601,7 +3620,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;
|
||||
@@ -3610,6 +3629,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,
|
||||
@@ -3653,6 +3674,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) */
|
||||
@@ -3755,13 +3777,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);
|
||||
@@ -3777,6 +3801,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
|
||||
|
Reference in New Issue
Block a user