Sometimes replication halts with an error like:
Slave I/O: Got fatal error 1236 from master when reading
data from binary log
Error reading packet from server: log event entry exceeded
max_allowed_packet; Increase max_allowed_packet on master;
If it's the SQL thread instead of the I/O thread, it might complain about 'Event too big'. The error could also be the other direction, complaining of 'Event too small'.
I rarely see this error actually have anything to do with max_allowed_packet. You can check the largest event in the master's binary log file. Even though the binary log records the length in each entry, mysqlbinlog doesn't expose it, so we have to do the math ourselves:
mysqlbinlog mysql-bin.00XXX | gawk "/^# at / { diff = $3 - prev; prev = $3; } (diff > max) { max = diff } END {print max}" -
If the result is larger than max_allowed_packet, then the problem and solution are …
[Read more]