summaryrefslogtreecommitdiff
path: root/sql/slave.cc
diff options
context:
space:
mode:
authorManish Kumar <manish.4.kumar@oracle.com>2012-05-30 10:10:52 +0530
committerManish Kumar <manish.4.kumar@oracle.com>2012-05-30 10:10:52 +0530
commit6c03d09e2e96bed671675f1882e6ab1ff821d50c (patch)
tree178e58bbf700e104a9c217e2dad24525b09dd285 /sql/slave.cc
parent35d4c18ef46923d4d1102ea290365e5704574792 (diff)
parent9aa79dc5966b6bba74c772d110265161a018cbf2 (diff)
downloadmariadb-git-6c03d09e2e96bed671675f1882e6ab1ff821d50c.tar.gz
BUG#12400221 - 60926: BINARY LOG EVENTS LARGER THAN MAX_ALLOWED_PACKET
Problem ======== Replication breaks in the cases if the event length exceeds the size of master Dump thread's max_allowed_packet. The reason why this failure is occuring is because the event length is more than the total size of the max_allowed_packet, on addition of the max_event_header length exceeds the max_allowed_packet of the DUMP thread. This causes the Dump thread to break replication and throw an error. That can happen e.g with row-based replication in Update_rows event. Fix ==== The problem is fixed in 2 steps: 1.) The Dump thread limit to read event is increased to the upper limit i.e. Dump thread reads whatever gets logged in the binary log. 2.) On the slave side we increase the the max_allowed_packet for the slave's threads (IO/SQL) by increasing it to 1GB. This is done using the new server option (slave_max_allowed_packet) included, is used to regulate the max_allowed_packet of the slave thread (IO/SQL) by the DBA, and facilitates the sending of large packets from the master to the slave. This causes the large packets to be received by the slave and apply it successfully.
Diffstat (limited to 'sql/slave.cc')
-rw-r--r--sql/slave.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/sql/slave.cc b/sql/slave.cc
index 437762cc318..288077a6326 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1884,8 +1884,7 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
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= global_system_variables.max_allowed_packet
- + MAX_LOG_EVENT_HEADER; /* note, incr over the global not session var */
+ thd->variables.max_allowed_packet= slave_max_allowed_packet;
thd->slave_thread = 1;
thd->enable_slow_log= opt_log_slow_slave_statements;
set_slave_thread_options(thd);
@@ -2630,6 +2629,7 @@ pthread_handler_t handle_slave_io(void *arg)
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
@@ -2761,12 +2761,12 @@ reading event"))
switch (mysql_error_number) {
case CR_NET_PACKET_TOO_LARGE:
sql_print_error("\
-Log entry on master is longer than max_allowed_packet (%ld) on \
+Log entry on master is longer than slave_max_allowed_packet (%lu) on \
slave. If the entry is correct, restart the server with a higher value of \
-max_allowed_packet",
- thd->variables.max_allowed_packet);
+slave_max_allowed_packet",
+ slave_max_allowed_packet);
mi->report(ERROR_LEVEL, ER_NET_PACKET_TOO_LARGE,
- "%s", ER(ER_NET_PACKET_TOO_LARGE));
+ "%s", "Got a packet bigger than 'slave_max_allowed_packet' bytes");
goto err;
case ER_MASTER_FATAL_ERROR_READING_BINLOG:
mi->report(ERROR_LEVEL, ER_MASTER_FATAL_ERROR_READING_BINLOG,