Bug #33413 show binlog events fails if binlog has event size of close to max_allowed_packet
Submitted: 20 Dec 2007 17:24 Modified: 6 Feb 2008 20:57
Reporter: Andrei Elkin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S2 (Serious)
Version:5.0 OS:Any
Assigned to: Andrei Elkin CPU Architecture:Any
Triage: D2 (Serious)

[20 Dec 2007 17:24] Andrei Elkin
Description:
Found during testing fixes for bug#30435 although there can be any other than
replication events in place of Append_Block event of that bug.

If an event is recorded in binlog it can have size of bigger than max_allowed_packet due to the replication packet header.
Bug #19402 addressed an issue of reading and sending such events to the slave.
However, there left another overloaded read_log_event that is invoked in
show binlog events processing. And that method overreact to throw an error
having not accounted the packet header extra.

How to repeat:
E.g: a similar to bug#30435 test case that generates events for load data infile.

1. start master server with 

--max_allowed_packet=16K --read_buffer_size=16K

2. create a file size of exceeding 16K e.g

  for i in `seq 1 10000`; do echo $i >> /tmp/10k.txt; done;

3. 
 CREATE TABLE load_table (id int not null primary key auto_increment);
 load data infile '/tmp/10k.txt' into table load_table;
 
4. show binlog events;

=>

ERROR 1220 (HY000): Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error

and in the error log

071220 17:43:42 [ERROR] Error in Log_event::read_log_event(): 'Event too big', data_len: 15383, event_type: 17

Suggested fix:
Use the same as bug#19402 max replication packet header estimation to increment
the executing thread's max_allowed_packet.
[21 Dec 2007 20:44] Andrei Elkin
The patch was done along with Bug #30435 fixes.
[5 Feb 2008 12:45] Bugs System
Pushed into 5.0.56
[5 Feb 2008 13:03] Bugs System
Pushed into 5.1.24-rc
[5 Feb 2008 13:07] Bugs System
Pushed into 6.0.5-alpha
[6 Feb 2008 17:49] Jon Stephens
Documented bugfix in the 5.0.56, 5.1.23, and 6.0.5 changelogs as follows:

        SHOW BINLOG EVENTS could fail when the binlog
        contained one or more events whose size was close to the value of
        max_allowed_packet.