Skip to content

bug: When the format of binlog is row, the load data statement cannot be recorded. #1876

@adofsauron

Description

@adofsauron

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

  • I confirm there is no existing issue for this

Describe the problem

# cat /tmp/aaa.csv
1,AAA
2,BBB

mysql> show variables like 'binlog_format';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| binlog_format | ROW   |
+---------------+-------+
1 row in set (0.00 sec)

mysql> create table aaa(id int,name varchar(5));
Query OK, 0 rows affected (0.11 sec)

mysql> load data infile '/tmp/aaa.csv' into table aaa FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
Query OK, 2 rows affected (0.08 sec)
Records: 2  Deleted: 0  Skipped: 0  Warnings: 0

mysql> select * from aaa;
+------+------+
| id   | name |
+------+------+
|    1 | AAA  |
|    2 | BBB  |
+------+------+
2 rows in set (0.00 sec)

### parse binlog
# /opt/stonedb57/install/bin/mysqlbinlog --base64-output=decode-rows -vv binlog.000003
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
#230614  2:07:59 server id 1  end_log_pos 123 CRC32 0x276e7bd4  Start: binlog v 4, server v 5.7.36-StoneDB-v1.0.1 created 230614  2:07:59
# Warning: this binlog is either in use or was not closed properly.
# at 123
#230614  2:07:59 server id 1  end_log_pos 194 CRC32 0xe6bbb0c6  Previous-GTIDs
# 8d83d267-004d-11ee-b38d-002228b9f6f0:1-2
# at 194
#230614  2:08:32 server id 1  end_log_pos 259 CRC32 0x1a21de6b  GTID    last_committed=0        sequence_number=1       rbr_only=no
SET @@SESSION.GTID_NEXT= '8d83d267-004d-11ee-b38d-002228b9f6f0:3'/*!*/;
# at 259
#230614  2:08:32 server id 1  end_log_pos 369 CRC32 0xf908f07c  Query   thread_id=4     exec_time=0     error_code=0
use `db`/*!*/;
SET TIMESTAMP=1686708512/*!*/;
SET @@session.pseudo_thread_id=4/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=1344274432/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C utf8 *//*!*/;
SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=45/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
create table aaa(id int,name varchar(5))
/*!*/;
# at 369
#230614  2:08:47 server id 1  end_log_pos 434 CRC32 0x54bd9dbf  GTID    last_committed=1        sequence_number=2       rbr_only=no
SET @@SESSION.GTID_NEXT= '8d83d267-004d-11ee-b38d-002228b9f6f0:4'/*!*/;
# at 434
#230614  2:08:47 server id 1  end_log_pos 504 CRC32 0x82cff7cf  Query   thread_id=4     exec_time=0     error_code=0
SET TIMESTAMP=1686708527/*!*/;
BEGIN
/*!*/;
WARNING: Ignoring Execute_load_query since there is no Begin_load_query event for file_id: 0
# at 504
# at 726
#230614  2:08:47 server id 1  end_log_pos 797 CRC32 0x2c0a9ff2  Query   thread_id=4     exec_time=0     error_code=0
SET TIMESTAMP=1686708527/*!*/;
COMMIT
/*!*/;
SET @@SESSION.GTID_NEXT= 'AUTOMATIC' /* added by mysqlbinlog */ /*!*/;
DELIMITER ;
# End of log file
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;

Expected behavior

### INSERT INTO `db`.`aaa`
### SET
###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
###   @2='AAA' /* VARSTRING(5) meta=5 nullable=1 is_null=0 */
### INSERT INTO `db`.`aaa`
### SET
###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
###   @2='BBB' /* VARSTRING(5) meta=5 nullable=1 is_null=0 */

How To Reproduce

No response

Environment

./mysqld Ver 5.7.36-StoneDB-v1.0.1 for Linux on x86_64 (build-)
build information as follow:
Repository address: https://github.com/stoneatom/stonedb.git:stonedb-5.7-dev
Branch name: stonedb-5.7-dev
Last commit ID: 1f43e44
Last commit time: Date: Wed May 31 17:34:21 2023 +0800
Build time: Date: Thu Jun 1 07:20:38 UTC 2023

Are you interested in submitting a PR to solve the problem?

  • Yes, I will!

Metadata

Metadata

Labels

A-bugSomething isn't workingprio: highHigh priority

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions