debezium / debezium/dbz

Preserve MySQL comments in change events [DBZ-1239]

Open
#217 0 comments 0 reactions 0 assignees View on GitHub
component/dependencies component/mysql-connector migrated-from-jira type/enhancement
Dominant language
HTML
Stars
6
Forks
8
Avg merge
2d 19h
Merged PRs (30d)
1

Description

Migrated from [DBZ-1239](https://issues.redhat.com/browse/DBZ-1239)

I have a use case where I'm writing some additional transaction information to the MySQL binlog via a comment appended to the SQL statement. I've enabled the MySQL sysvar binlog_rows_query_log_events so the SQL statement is written to the binlog along with the row-based log info (see example below).

However, it appears that the Debezium SQL parser strips these comments from the statement before publishing the change event.

This feature request is to preserve these comments (as they appear in the binlog) instead of stripping them.
----
Binlog example with comment in MySQL statement:
{noformat}
BEGIN
/*!*/;
# at 961
#190320 17:02:04 server id 419 end_log_pos 1085 Rows_query
# INSERT INTO my_table VALUES (999, 888, 777, 666) /* ADDITIONAL TRANSACTION INFORMATION */ #
# at 1085
#190320 17:02:04 server id 419 end_log_pos 1145 Table_map: `mydb`.`my_table` mapped to number 27176
# at 1145
#190320 17:02:04 server id 419 end_log_pos 1187 Write_rows: table id 27176 flags: STMT_END_F
### INSERT INTO `mydb`.`my_table`
### SET
### @1=999 /* INT meta=0 nullable=0 is_null=0 */
### @2=888 /* INT meta=0 nullable=0 is_null=0 */
### @3=777 /* TINYINT meta=0 nullable=0 is_null=0 */
### @4=666 /* TINYINT meta=0 nullable=0 is_null=0 */
# at 1187
#190320 17:02:24 server id 419 end_log_pos 1214 Xid = 17397187
COMMIT/*!*/;
SET @@SESSION.GTID_NEXT= 'AUTOMATIC' /* added by mysqlbinlog */ /*!*/;
DELIMITER ;{noformat}

Contributor guide

Open the contributing guide

Research direction

Start by tracing the Debezium SQL parser handling of MySQL Rows_query events and compare it with the binlog example in the issue. The work is done when comments from the original MySQL statement are preserved in the published change event rather than stripped.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.