mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
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.
This commit is contained in:
12
sql/slave.cc
12
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,
|
||||
|
Reference in New Issue
Block a user