diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-07-16 19:09:54 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-07-16 19:09:54 +0200 |
commit | 005c7e54214546584c8dc67a746e215f8dbe4b58 (patch) | |
tree | dea50cd7b32808413e058d43d20cf230d1cc7477 /sql/slave.cc | |
parent | b9f220b45afaae9b61af29129a8c8ec5f9a7759b (diff) | |
parent | 4f5c10e6b565bc2761b9d083e25c6a36141552a0 (diff) | |
download | mariadb-git-005c7e54214546584c8dc67a746e215f8dbe4b58.tar.gz |
mysql-5.5.32 merge
Diffstat (limited to 'sql/slave.cc')
-rw-r--r-- | sql/slave.cc | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/sql/slave.cc b/sql/slave.cc index 02ab69af0e8..19c84174cc2 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -159,6 +159,37 @@ static int terminate_slave_thread(THD *thd, volatile uint *slave_running, bool skip_lock); static bool check_io_slave_killed(THD *thd, Master_info *mi, const char *info); +/* + Function to set the slave's max_allowed_packet based on the value + of slave_max_allowed_packet. + + @in_param thd Thread handler for slave + @in_param mysql MySQL connection handle +*/ + +static void set_slave_max_allowed_packet(THD *thd, MYSQL *mysql) +{ + DBUG_ENTER("set_slave_max_allowed_packet"); + // thd and mysql must be valid + DBUG_ASSERT(thd && mysql); + + thd->variables.max_allowed_packet= slave_max_allowed_packet; + thd->net.max_packet_size= slave_max_allowed_packet; + /* + Adding MAX_LOG_EVENT_HEADER_LEN to the max_packet_size on the I/O + thread and the mysql->option max_allowed_packet, since a + replication event can become this much larger than + the corresponding packet (query) sent from client to master. + */ + thd->net.max_packet_size+= MAX_LOG_EVENT_HEADER; + /* + Skipping the setting of mysql->net.max_packet size to slave + max_allowed_packet since this is done during mysql_real_connect. + */ + mysql->options.max_allowed_packet= + slave_max_allowed_packet+MAX_LOG_EVENT_HEADER; + DBUG_VOID_RETURN; +} /* Find out which replications threads are running @@ -2278,12 +2309,6 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type) SYSTEM_THREAD_SLAVE_SQL : SYSTEM_THREAD_SLAVE_IO; thd->security_ctx->skip_grants(); my_net_init(&thd->net, 0); -/* - Adding MAX_LOG_EVENT_HEADER_LEN to the max_allowed_packet on all - slave threads, since a replication event can become this much larger - than the corresponding packet (query) sent from client to master. -*/ - thd->variables.max_allowed_packet= slave_max_allowed_packet; thd->slave_thread = 1; thd->enable_slow_log= opt_log_slow_slave_statements; thd->variables.log_slow_filter= global_system_variables.log_slow_filter; @@ -3067,13 +3092,6 @@ pthread_handler_t handle_slave_io(void *arg) mi->user, mi->host, mi->port, IO_RPL_LOG_NAME, llstr(mi->master_log_pos,llbuff)); - /* - Adding MAX_LOG_EVENT_HEADER_LEN to the max_packet_size on the I/O - thread, since a replication event can become this much larger than - the corresponding packet (query) sent from client to master. - */ - thd->net.max_packet_size= slave_max_allowed_packet; - mysql->net.max_packet_size= thd->net.max_packet_size+= MAX_LOG_EVENT_HEADER; } else { @@ -4638,7 +4656,7 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi, ulong err_count=0; char llbuff[22]; DBUG_ENTER("connect_to_master"); - + set_slave_max_allowed_packet(thd, mysql); #ifndef DBUG_OFF mi->events_till_disconnect = disconnect_slave_event_count; #endif |