[MDEV-21241] Multi-line statement Annotate rows event gets truncated Created: 2019-12-06  Updated: 2023-04-27

Status: Confirmed
Project: MariaDB Server
Component/s: Scripts & Clients
Affects Version/s: 10.4.8, 10.2, 10.3, 10.4
Fix Version/s: 10.4

Type: Bug Priority: Major
Reporter: Anders Karlsson Assignee: Andrei Elkin
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Linux CentOS 7.6



 Description   

The commented SQL statement in the output from mariadb-binlog get's truncated with a few characters when the SQL statement is multi-line and binlog format ROW is used.
To reproduce:

MariaDB [test]> create table t1(c1 varchar(10));
Query OK, 0 rows affected (0.323 sec)
 
MariaDB [test]> insert into t1 values('Row 1');
Query OK, 1 row affected (0.049 sec)
 
MariaDB [test]> insert into t1 values('Row 2'),
    -> ('Row 3');
Query OK, 2 rows affected (0.140 sec)
Records: 2  Duplicates: 0  Warnings: 0

Now look at the binlog with mariadb-binlog, and the output (an extract) looks like this:

#191206 14:33:46 server id 100  end_log_pos 1472 CRC32 0x05e963a5       Annotate_rows:
#Q> insert into t1 values('Row 1')
#191206 14:33:46 server id 100  end_log_pos 1519 CRC32 0x7cfec504       Table_map: `test`.`t1` mapped to number 30
# at 1519
#191206 14:33:46 server id 100  end_log_pos 1559 CRC32 0x9ab57731       Write_rows: table id 30 flags: STMT_END_F
 
BINLOG '
uljqXRNkAAAALwAAAO8FAAAAAB4AAAAAAAEABHRlc3QAAnQxAAEPAgoAAQTF/nw=
uljqXRdkAAAAKAAAABcGAAAAAB4AAAAAAAEAAf/+BVJvdyAxMXe1mg==
'/*!*/;
# Number of rows: 1
# at 1559
#191206 14:33:46 server id 100  end_log_pos 1590 CRC32 0x959ad94b       Xid = 57
COMMIT/*!*/;
# at 1590
#191206 14:33:56 server id 100  end_log_pos 1632 CRC32 0x9dbd1c81       GTID 0-100-220877 trans
/*!100001 SET @@session.gtid_seq_no=220877*//*!*/;
BEGIN
/*!*/;
# at 1632
# at 1696
#191206 14:33:56 server id 100  end_log_pos 1696 CRC32 0x323317ba       Annotate_rows:
#Q> insert into t1 values('Row 2'),
#Q> ('Row 3'
#191206 14:33:56 server id 100  end_log_pos 1743 CRC32 0xc497312c       Table_map: `test`.`t1` mapped to number 30

As can be seen, the last insert in the output has the second line truncated and is missing a closing quite and a parentetis.



 Comments   
Comment by Alice Sherepa [ 2019-12-09 ]

Thanks! Reproducible as described on 10.2-10.4

Generated at Thu Feb 08 09:05:39 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.