Bug #93544 SHOW BINLOG EVENTS FROM <bad offset> is not diagnosed
Submitted: 10 Dec 2018 14:39 Modified: 16 Jan 2019 15:34
Reporter: Laurynas Biveinis (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:8.0.13 OS:Any
Assigned to: CPU Architecture:Any
Tags: regression

[10 Dec 2018 14:39] Laurynas Biveinis
Description:
SHOW BINLOG EVENTS now accepts invalid starting offsets, silently:

SHOW BINLOG EVENTS FROM 14 LIMIT 1;
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
binlog.000001	14	Previous_gtids	1	155	

SHOW BINLOG EVENTS FROM 15 LIMIT 1;
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
binlog.000001	15	Previous_gtids	1	155	

SHOW BINLOG EVENTS FROM 16 LIMIT 1;
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
binlog.000001	16	Previous_gtids	1	155

whereas valid offsets here would be

SHOW BINLOG EVENTS LIMIT 10;
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
binlog.000001	4	Format_desc	1	124	Server ver: 8.0.13-debug-asan-ubsan, Binlog ver: 4
binlog.000001	124	Previous_gtids	1	155	

Previous versions diagnosed this to error log, which was a bug by itself: bug 75480 (bug 89507, bug 86545)

How to repeat:
CREATE TABLE t (a INT, b INT);

INSERT INTO t (a, b) VALUES (1, 1);
INSERT INTO t (a, b) VALUES (2, 2);
INSERT INTO t (a, b) VALUES (3, 3);
INSERT INTO t (a, b) VALUES (4, 4);
INSERT INTO t (a, b) VALUES (5, 5);
INSERT INTO t (a, b) VALUES (6, 6);
INSERT INTO t (a, b) VALUES (7, 7);

SHOW BINLOG EVENTS FROM 14 LIMIT 1;
SHOW WARNINGS; # To see that no warnings
SHOW BINLOG EVENTS FROM 15 LIMIT 1;
SHOW WARNINGS;
SHOW BINLOG EVENTS FROM 16 LIMIT 1;
SHOW WARNINGS;

SHOW BINLOG EVENTS LIMIT 10;

Suggested fix:
Show correct starting offset of the event the invalid position falls in - or skip to the next one
[11 Dec 2018 6:19] MySQL Verification Team
Hello Laurynas,

Thank you for the report.

regards,
Umesh
[16 Jan 2019 15:34] Margaret Fisher
Posted by developer:
 
Changelog entry added for MySQL 8.0.16:

If an invalid starting offset was provided in a SHOW BINLOG EVENTS FROM statement, the invalid offset was returned in place of the correct starting position for the first returned event.