Commit 2dae38c7 authored by unknown's avatar unknown

Replication were broken because of automatic charset conversion.

As a fix, my_charset_bin is now used in master-slave packets instead
of system_charset_info.

parent 1159272c
...@@ -348,10 +348,10 @@ int Log_event::net_send(Protocol *protocol, const char* log_name, my_off_t pos) ...@@ -348,10 +348,10 @@ int Log_event::net_send(Protocol *protocol, const char* log_name, my_off_t pos)
log_name = p + 1; log_name = p + 1;
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(log_name, system_charset_info); protocol->store(log_name, &my_charset_bin);
protocol->store((ulonglong) pos); protocol->store((ulonglong) pos);
event_type = get_type_str(); event_type = get_type_str();
protocol->store(event_type, strlen(event_type), system_charset_info); protocol->store(event_type, strlen(event_type), &my_charset_bin);
protocol->store((uint32) server_id); protocol->store((uint32) server_id);
protocol->store((ulonglong) log_pos); protocol->store((ulonglong) log_pos);
pack_info(protocol); pack_info(protocol);
...@@ -722,7 +722,7 @@ void Query_log_event::pack_info(Protocol *protocol) ...@@ -722,7 +722,7 @@ void Query_log_event::pack_info(Protocol *protocol)
memcpy(pos, query, q_len); memcpy(pos, query, q_len);
pos+= q_len; pos+= q_len;
} }
protocol->store(buf, pos-buf, system_charset_info); protocol->store(buf, pos-buf, &my_charset_bin);
my_free(buf, MYF(MY_ALLOW_ZERO_PTR)); my_free(buf, MYF(MY_ALLOW_ZERO_PTR));
} }
#endif #endif
...@@ -992,7 +992,7 @@ void Start_log_event::pack_info(Protocol *protocol) ...@@ -992,7 +992,7 @@ void Start_log_event::pack_info(Protocol *protocol)
pos= strmov(pos, server_version); pos= strmov(pos, server_version);
pos= strmov(pos, ", Binlog ver: "); pos= strmov(pos, ", Binlog ver: ");
pos=int10_to_str(binlog_version, pos, 10); pos=int10_to_str(binlog_version, pos, 10);
protocol->store(buf, pos-buf, system_charset_info); protocol->store(buf, pos-buf, &my_charset_bin);
} }
#endif #endif
...@@ -1191,7 +1191,7 @@ void Load_log_event::pack_info(Protocol *protocol) ...@@ -1191,7 +1191,7 @@ void Load_log_event::pack_info(Protocol *protocol)
*pos++= ')'; *pos++= ')';
} }
protocol->store(buf, pos-buf, system_charset_info); protocol->store(buf, pos-buf, &my_charset_bin);
my_free(buf, MYF(MY_ALLOW_ZERO_PTR)); my_free(buf, MYF(MY_ALLOW_ZERO_PTR));
} }
#endif #endif
...@@ -1665,7 +1665,7 @@ void Rotate_log_event::pack_info(Protocol *protocol) ...@@ -1665,7 +1665,7 @@ void Rotate_log_event::pack_info(Protocol *protocol)
b_pos=longlong10_to_str(pos, b_pos, 10); b_pos=longlong10_to_str(pos, b_pos, 10);
if (flags & LOG_EVENT_FORCED_ROTATE_F) if (flags & LOG_EVENT_FORCED_ROTATE_F)
b_pos= strmov(b_pos ,"; forced by master"); b_pos= strmov(b_pos ,"; forced by master");
protocol->store(buf, b_pos-buf, system_charset_info); protocol->store(buf, b_pos-buf, &my_charset_bin);
my_free(buf, MYF(MY_ALLOW_ZERO_PTR)); my_free(buf, MYF(MY_ALLOW_ZERO_PTR));
} }
#endif #endif
...@@ -1800,7 +1800,7 @@ void Intvar_log_event::pack_info(Protocol *protocol) ...@@ -1800,7 +1800,7 @@ void Intvar_log_event::pack_info(Protocol *protocol)
pos= strmov(buf, get_var_type_name()); pos= strmov(buf, get_var_type_name());
*(pos++)='='; *(pos++)='=';
pos= longlong10_to_str(val, pos, -10); pos= longlong10_to_str(val, pos, -10);
protocol->store(buf, pos-buf, system_charset_info); protocol->store(buf, pos-buf, &my_charset_bin);
} }
#endif #endif
...@@ -1911,7 +1911,7 @@ void Rand_log_event::pack_info(Protocol *protocol) ...@@ -1911,7 +1911,7 @@ void Rand_log_event::pack_info(Protocol *protocol)
pos= int10_to_str((long) seed1, pos, 10); pos= int10_to_str((long) seed1, pos, 10);
pos= strmov(pos, ",rand_seed2="); pos= strmov(pos, ",rand_seed2=");
pos= int10_to_str((long) seed2, pos, 10); pos= int10_to_str((long) seed2, pos, 10);
protocol->store(buf1, (uint) (pos-buf1), system_charset_info); protocol->store(buf1, (uint) (pos-buf1), &my_charset_bin);
} }
#endif #endif
...@@ -2013,7 +2013,7 @@ void User_var_log_event::pack_info(Protocol* protocol) ...@@ -2013,7 +2013,7 @@ void User_var_log_event::pack_info(Protocol* protocol)
buf[0]= '@'; buf[0]= '@';
buf[1+name_len]= '='; buf[1+name_len]= '=';
memcpy(buf+1, name, name_len); memcpy(buf+1, name, name_len);
protocol->store(buf, event_len, system_charset_info); protocol->store(buf, event_len, &my_charset_bin);
my_free(buf, MYF(MY_ALLOW_ZERO_PTR)); my_free(buf, MYF(MY_ALLOW_ZERO_PTR));
} }
#endif // !MYSQL_CLIENT #endif // !MYSQL_CLIENT
...@@ -2213,7 +2213,7 @@ void Slave_log_event::pack_info(Protocol *protocol) ...@@ -2213,7 +2213,7 @@ void Slave_log_event::pack_info(Protocol *protocol)
pos= strmov(pos, master_log); pos= strmov(pos, master_log);
pos= strmov(pos, ",pos="); pos= strmov(pos, ",pos=");
pos= longlong10_to_str(master_pos, pos, 10); pos= longlong10_to_str(master_pos, pos, 10);
protocol->store(buf, pos-buf, system_charset_info); protocol->store(buf, pos-buf, &my_charset_bin);
} }
#endif // !MYSQL_CLIENT #endif // !MYSQL_CLIENT
...@@ -2547,7 +2547,7 @@ void Create_file_log_event::pack_info(Protocol *protocol) ...@@ -2547,7 +2547,7 @@ void Create_file_log_event::pack_info(Protocol *protocol)
pos= int10_to_str((long) file_id, pos, 10); pos= int10_to_str((long) file_id, pos, 10);
pos= strmov(pos, ";block_len="); pos= strmov(pos, ";block_len=");
pos= int10_to_str((long) block_len, pos, 10); pos= int10_to_str((long) block_len, pos, 10);
protocol->store(buf, pos-buf, system_charset_info); protocol->store(buf, pos-buf, &my_charset_bin);
} }
#endif #endif
...@@ -2698,7 +2698,7 @@ void Append_block_log_event::pack_info(Protocol *protocol) ...@@ -2698,7 +2698,7 @@ void Append_block_log_event::pack_info(Protocol *protocol)
length= (uint) my_sprintf(buf, length= (uint) my_sprintf(buf,
(buf, ";file_id=%u;block_len=%u", file_id, (buf, ";file_id=%u;block_len=%u", file_id,
block_len)); block_len));
protocol->store(buf, (int32) length, system_charset_info); protocol->store(buf, (int32) length, &my_charset_bin);
} }
#endif #endif
...@@ -2811,7 +2811,7 @@ void Delete_file_log_event::pack_info(Protocol *protocol) ...@@ -2811,7 +2811,7 @@ void Delete_file_log_event::pack_info(Protocol *protocol)
char buf[64]; char buf[64];
uint length; uint length;
length= (uint) my_sprintf(buf, (buf, ";file_id=%u", (uint) file_id)); length= (uint) my_sprintf(buf, (buf, ";file_id=%u", (uint) file_id));
protocol->store(buf, (int32) length, system_charset_info); protocol->store(buf, (int32) length, &my_charset_bin);
} }
#endif #endif
...@@ -2910,7 +2910,7 @@ void Execute_load_log_event::pack_info(Protocol *protocol) ...@@ -2910,7 +2910,7 @@ void Execute_load_log_event::pack_info(Protocol *protocol)
char buf[64]; char buf[64];
uint length; uint length;
length= (uint) my_sprintf(buf, (buf, ";file_id=%u", (uint) file_id)); length= (uint) my_sprintf(buf, (buf, ";file_id=%u", (uint) file_id));
protocol->store(buf, (int32) length, system_charset_info); protocol->store(buf, (int32) length, &my_charset_bin);
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -440,7 +440,7 @@ int show_new_master(THD* thd) ...@@ -440,7 +440,7 @@ int show_new_master(THD* thd)
if (protocol->send_fields(&field_list, 1)) if (protocol->send_fields(&field_list, 1))
DBUG_RETURN(-1); DBUG_RETURN(-1);
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(lex_mi->log_file_name, system_charset_info); protocol->store(lex_mi->log_file_name, &my_charset_bin);
protocol->store((ulonglong) lex_mi->pos); protocol->store((ulonglong) lex_mi->pos);
if (protocol->write()) if (protocol->write())
DBUG_RETURN(-1); DBUG_RETURN(-1);
...@@ -610,11 +610,11 @@ int show_slave_hosts(THD* thd) ...@@ -610,11 +610,11 @@ int show_slave_hosts(THD* thd)
SLAVE_INFO* si = (SLAVE_INFO*) hash_element(&slave_list, i); SLAVE_INFO* si = (SLAVE_INFO*) hash_element(&slave_list, i);
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store((uint32) si->server_id); protocol->store((uint32) si->server_id);
protocol->store(si->host, system_charset_info); protocol->store(si->host, &my_charset_bin);
if (opt_show_slave_auth_info) if (opt_show_slave_auth_info)
{ {
protocol->store(si->user, system_charset_info); protocol->store(si->user, &my_charset_bin);
protocol->store(si->password, system_charset_info); protocol->store(si->password, &my_charset_bin);
} }
protocol->store((uint32) si->port); protocol->store((uint32) si->port);
protocol->store((uint32) si->rpl_recovery_rank); protocol->store((uint32) si->rpl_recovery_rank);
......
...@@ -1608,22 +1608,22 @@ int show_master_info(THD* thd, MASTER_INFO* mi) ...@@ -1608,22 +1608,22 @@ int show_master_info(THD* thd, MASTER_INFO* mi)
pthread_mutex_lock(&mi->data_lock); pthread_mutex_lock(&mi->data_lock);
pthread_mutex_lock(&mi->rli.data_lock); pthread_mutex_lock(&mi->rli.data_lock);
protocol->store(mi->host, system_charset_info); protocol->store(mi->host, &my_charset_bin);
protocol->store(mi->user, system_charset_info); protocol->store(mi->user, &my_charset_bin);
protocol->store((uint32) mi->port); protocol->store((uint32) mi->port);
protocol->store((uint32) mi->connect_retry); protocol->store((uint32) mi->connect_retry);
protocol->store(mi->master_log_name, system_charset_info); protocol->store(mi->master_log_name, &my_charset_bin);
protocol->store((ulonglong) mi->master_log_pos); protocol->store((ulonglong) mi->master_log_pos);
protocol->store(mi->rli.relay_log_name + protocol->store(mi->rli.relay_log_name +
dirname_length(mi->rli.relay_log_name), system_charset_info); dirname_length(mi->rli.relay_log_name), &my_charset_bin);
protocol->store((ulonglong) mi->rli.relay_log_pos); protocol->store((ulonglong) mi->rli.relay_log_pos);
protocol->store(mi->rli.master_log_name, system_charset_info); protocol->store(mi->rli.master_log_name, &my_charset_bin);
protocol->store(mi->slave_running ? "Yes":"No", system_charset_info); protocol->store(mi->slave_running ? "Yes":"No", &my_charset_bin);
protocol->store(mi->rli.slave_running ? "Yes":"No", system_charset_info); protocol->store(mi->rli.slave_running ? "Yes":"No", &my_charset_bin);
protocol->store(&replicate_do_db); protocol->store(&replicate_do_db);
protocol->store(&replicate_ignore_db); protocol->store(&replicate_ignore_db);
protocol->store((uint32) mi->rli.last_slave_errno); protocol->store((uint32) mi->rli.last_slave_errno);
protocol->store(mi->rli.last_slave_error, system_charset_info); protocol->store(mi->rli.last_slave_error, &my_charset_bin);
protocol->store((uint32) mi->rli.slave_skip_counter); protocol->store((uint32) mi->rli.slave_skip_counter);
protocol->store((ulonglong) mi->rli.master_log_pos); protocol->store((ulonglong) mi->rli.master_log_pos);
protocol->store((ulonglong) mi->rli.log_space_total); protocol->store((ulonglong) mi->rli.log_space_total);
......
...@@ -384,7 +384,7 @@ impossible position"; ...@@ -384,7 +384,7 @@ impossible position";
We need to start a packet with something other than 255 We need to start a packet with something other than 255
to distiquish it from error to distiquish it from error
*/ */
packet->set("\0", 1, system_charset_info); packet->set("\0", 1, &my_charset_bin);
// if we are at the start of the log // if we are at the start of the log
if (pos == BIN_LOG_HEADER_SIZE) if (pos == BIN_LOG_HEADER_SIZE)
...@@ -395,7 +395,7 @@ impossible position"; ...@@ -395,7 +395,7 @@ impossible position";
my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG; my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG;
goto err; goto err;
} }
packet->set("\0", 1, system_charset_info); packet->set("\0", 1, &my_charset_bin);
} }
while (!net->error && net->vio != 0 && !thd->killed) while (!net->error && net->vio != 0 && !thd->killed)
...@@ -430,7 +430,7 @@ impossible position"; ...@@ -430,7 +430,7 @@ impossible position";
goto err; goto err;
} }
} }
packet->set("\0", 1, system_charset_info); packet->set("\0", 1, &my_charset_bin);
} }
/* /*
TODO: now that we are logging the offset, check to make sure TODO: now that we are logging the offset, check to make sure
...@@ -550,7 +550,7 @@ Increase max_allowed_packet on master"; ...@@ -550,7 +550,7 @@ Increase max_allowed_packet on master";
goto err; goto err;
} }
} }
packet->set("\0", 1, system_charset_info); packet->set("\0", 1, &my_charset_bin);
/* /*
No need to net_flush because we will get to flush later when No need to net_flush because we will get to flush later when
we hit EOF pretty quick we hit EOF pretty quick
...@@ -1103,7 +1103,7 @@ int show_binlog_info(THD* thd) ...@@ -1103,7 +1103,7 @@ int show_binlog_info(THD* thd)
LOG_INFO li; LOG_INFO li;
mysql_bin_log.get_current_log(&li); mysql_bin_log.get_current_log(&li);
int dir_len = dirname_length(li.log_file_name); int dir_len = dirname_length(li.log_file_name);
protocol->store(li.log_file_name + dir_len, system_charset_info); protocol->store(li.log_file_name + dir_len, &my_charset_bin);
protocol->store((ulonglong) li.pos); protocol->store((ulonglong) li.pos);
protocol->store(&binlog_do_db); protocol->store(&binlog_do_db);
protocol->store(&binlog_ignore_db); protocol->store(&binlog_ignore_db);
...@@ -1160,7 +1160,7 @@ int show_binlogs(THD* thd) ...@@ -1160,7 +1160,7 @@ int show_binlogs(THD* thd)
protocol->prepare_for_resend(); protocol->prepare_for_resend();
int dir_len = dirname_length(fname); int dir_len = dirname_length(fname);
/* The -1 is for removing newline from fname */ /* The -1 is for removing newline from fname */
protocol->store(fname + dir_len, length-1-dir_len, system_charset_info); protocol->store(fname + dir_len, length-1-dir_len, &my_charset_bin);
if (protocol->write()) if (protocol->write())
goto err; goto err;
} }
......
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