Comment 2 for bug 1409652

Revision history for this message
Peiran Song (peiran-song) wrote : Re: SHOW BINLOG EVENTS fails if binlog has event size of more than max_allowed_packet

Nil:

I wonder if the test you did just verified reading a "wrong" offset would result in such an error as Valerii also noted.

mysql> show master status \G
*************************** 1. row ***************************
             File: mysql-bin.000004
         Position: 692490956

mysql> SHOW BINLOG EVENTS IN 'mysql-bin.000004' FROM 692490800;

This 692490800 looks like an invalid offset.

I can't reproduce the bug on PS 5.6 nor PS 5.5. However, with both versions, invalid offset did result in this error.

I used a file over 5K to test:

node1> load data infile '/home/peiran/sandboxes/rsandbox_Percona-Server-5_5_28/master/5k.txt' into table bin_test fields terminated by '|' optionally
Query OK, 1 row affected, 1 warning (0.01 sec)
Records: 1 Deleted: 0 Skipped: 0 Warnings: 1

node1> show binlog events in "mysql-bin.000007";
+------------------+------+-------------+-----------+-------------+---------------------------------------------------------------------------------------------------------------------+
| Log_name | Pos | Event_type | Server_id | End_log_pos | Info |
+------------------+------+-------------+-----------+-------------+---------------------------------------------------------------------------------------------------------------------+
| mysql-bin.000007 | 4 | Format_desc | 101 | 120 | Server ver: 5.6.19-67.0-log, Binlog ver: 4 |
| mysql-bin.000007 | 120 | Query | 101 | 297 | use `test`; CREATE TABLE `bin_test` (
  `a` int(11) DEFAULT NULL,
  `b` text
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
| mysql-bin.000007 | 297 | Query | 101 | 369 | BEGIN |
| mysql-bin.000007 | 369 | Table_map | 101 | 422 | table_id: 72 (test.bin_test) |
| mysql-bin.000007 | 422 | Write_rows | 101 | 466 | table_id: 72 flags: STMT_END_F |
| mysql-bin.000007 | 466 | Xid | 101 | 497 | COMMIT /* xid=19 */ |
| mysql-bin.000007 | 497 | Query | 101 | 569 | BEGIN |
| mysql-bin.000007 | 569 | Table_map | 101 | 622 | table_id: 72 (test.bin_test) |
| mysql-bin.000007 | 622 | Write_rows | 101 | 9074 | table_id: 72 flags: STMT_END_F |
| mysql-bin.000007 | 9074 | Xid | 101 | 9105 | COMMIT /* xid=21 */ |
+------------------+------+-------------+-----------+-------------+---------------------------------------------------------------------------------------------------------------------+

The variables I set are:

node1> show variables like 'max_allowed%';
+--------------------+-------+
| Variable_name | Value |
+--------------------+-------+
| max_allowed_packet | 3072 |
+--------------------+-------+
1 row in set (0.00 sec)

node1> show variables like 'net_buffer%';
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| net_buffer_length | 3072 |
+-------------------+-------+
1 row in set (0.00 sec)

This last event is over max_allowed_packet, but I don't see error message in error log.

node1> show binlog events in "mysql-bin.000007" from 622;
+------------------+------+------------+-----------+-------------+--------------------------------+
| Log_name | Pos | Event_type | Server_id | End_log_pos | Info |
+------------------+------+------------+-----------+-------------+--------------------------------+
| mysql-bin.000007 | 622 | Write_rows | 101 | 9074 | table_id: 72 flags: STMT_END_F |
| mysql-bin.000007 | 9074 | Xid | 101 | 9105 | COMMIT /* xid=21 */ |
+------------------+------+------------+-----------+-------------+--------------------------------+
2 rows in set (0.00 sec)

Wrong offset does give error to client and log to error log:

node1> show binlog events in "mysql-bin.000007" from 101;
ERROR 1220 (HY000): Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error

2015-01-16 09:10:55 11118 [ERROR] Error in Log_event::read_log_event(): 'read error', data_len: 421071370, event_type: 2

This is tested on PS 5.6.19 and PS 5.5.28.