[MDEV-33239] mysqlbinlog cannot parse events written with system timestamp 4294967295 Created: 2024-01-13  Updated: 2024-01-26

Status: Open
Project: MariaDB Server
Component/s: Replication
Affects Version/s: N/A
Fix Version/s: 11.4

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Michael Widenius
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-32188 make TIMESTAMP use whole 32-bit unsig... In Testing

 Description   

If a binary log event is written when timestamp is 4294967295 (exactly that, not just any value greater than 2147483647), mysqlbinlog ignores it, and apparently the rest of the binary log.
It is not about displaying in verbose mode – it ignores events completely, so that they are not replayed upon trying to restore data from the binlog.

--source include/have_log_bin.inc
 
--let $datadir= `select @@datadir`
 
reset master;
create table t (a int);
insert into t values (1);
set @@timestamp= 4294967295;
insert into t values (2);
select * from t;
 
flush binary logs;
drop table t;
 
show binlog events in 'master-bin.000001';
--exec $MYSQL_BINLOG $datadir/master-bin.000001
--exec $MYSQL_BINLOG $datadir/master-bin.000001 | $MYSQL test
select * from t;
 
# Cleanup
drop table t;

In the test case above, row (1) is inserted with a normal timestamp, row (2) – with 4294967295.
In mysqlbinlog output we only see the first event:

bb-11.4-timestamp 6a706d142be3309de89c28bcb48e91a72e8e8f69

#240114  1:01:14 server id 1  end_log_pos 0 CRC32 0xf50d8a49 	Query	thread_id=5	exec_time=0	error_code=0	xid=0
SET TIMESTAMP=1705186874/*!*/;
insert into t values (1)
/*!*/;
# at 602
#240114  1:01:14 server id 1  end_log_pos 675 CRC32 0xdcf61fdb 	Query	thread_id=5	exec_time=0	error_code=0	xid=0
SET TIMESTAMP=1705186874/*!*/;
COMMIT
/*!*/;
DELIMITER ;
# End of log file

and upon replaying only one row is inserted:

select * from t;
a
1
drop table t;

Meanwhile, the record is actually in the binary log and can be seen in show binlog events output:

master-bin.000001	469	Gtid	1	511	BEGIN GTID 0-1-2
master-bin.000001	511	Query	1	0	use `test`; insert into t values (1)
master-bin.000001	602	Query	1	675	COMMIT
master-bin.000001	675	Gtid	1	717	BEGIN GTID 0-1-3
master-bin.000001	717	Query	1	0	use `test`; insert into t values (2)
master-bin.000001	808	Query	1	881	COMMIT


Generated at Thu Feb 08 10:37:26 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.