[MDEV-28768] mysqlbinlog can produce events larger than max_allowed_packet Created: 2022-06-08  Updated: 2023-12-07

Status: Stalled
Project: MariaDB Server
Component/s: Replication
Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Critical
Reporter: Andrei Elkin Assignee: Andrei Elkin
Resolution: Unresolved Votes: 0
Labels: None


 Description   

MDEV-10963 did not cover a case of to be fragmented Rows_log_event is not the final one
from its parent sql statement.

If one executes the following one a MariaDB server with "log_bin=1"
create or replace table t1 (a int primary key, b varchar(1024)) engine=innodb;
insert into t1 select seq,repeat("a",1024) from seq_1_to_100000

The generated binary log has an entry:
BINLOG '
BoA2ZRMBAAAAMAAAAPcBAAAAABIAAAAAAAEABHRlc3QAAnQxAAIDDwIABAJW98rq
BoA2ZRcBAAAAUhwAAEkeAAAAABIAAAAAAAAAAv/8AQAAAAAEYWFhYWFhYWFhYWFhYWFhYWFhYWFh
YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh
YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh
YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh
...
;
That is much bigger than max_packet_size.

This means one cannot send data to the server with mariadb-binlog --base64-output=auto | mysql ..

The task is to split BINLOG ... ;
into separate events no bigger than max_packet_size

There are two options to do that:

  • Create a separate BINLOG event for each internal row_binlog_event.
  • Split the BINLOG event into 'max_binlog_size' events.

Other things to fix in mariadb-binlog at the same time:

  • Ensure that --base64-output=auto is default (as said in mariadb-binlog --help)
  • Using --base64-output without options should be the same as using =auto

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