Description:
We have query rewrite plugin enabled and it does not seem to honor server settings binlog_row_metadata=FULL thus logging only the partial update statement. This is breaking CDC event generation via binlogs. Is there a known issue ?
How to repeat:
mysql> INSERT INTO query_rewrite.rewrite_rules (pattern_database, pattern, replacement) VALUES('db_name', 'SELECT * FROM table_name WHERE col_name = ?', 'SELECT * FROM table_name FORCE INDEX(idx_1) WHERE col_name = ?');
Query OK, 1 row affected (0.00 sec)
mysql> CALL query_rewrite.flush_rewrite_rules();
Query OK, 1 row affected (0.00 sec)
mysql>
--server settings
mysql> show global variables like '%binlog_row%';
+------------------------------+-------+
| Variable_name | Value |
+------------------------------+-------+
| binlog_row_event_max_size | 8192 |
| binlog_row_image | FULL |
| binlog_row_metadata | FULL |
| binlog_row_value_options | |
| binlog_rows_query_log_events | OFF |
+------------------------------+-------+
5 rows in set (0.01 sec)
--binlog content
#241022 14:47:12 server id 1 end_log_pos 4473 CRC32 0xbc3cfd03 Query thread_id=14 exec_time=0 error_code=0
SET TIMESTAMP=1729633632/*!*/;
BEGIN
/*!*/;
# at 4473
#241022 14:47:12 server id 1 end_log_pos 4684 CRC32 0x2c7e1a4b Table_map: `query_rewrite`.`rewrite_rules` mapped to number 85
# has_generated_invisible_primary_key=0
# at 4684
#241022 14:47:12 server id 1 end_log_pos 4842 CRC32 0x2e853bee Write_rows: table id 85 flags: STMT_END_F
BINLOG '
YB0YZxMBAAAA0wAAAEwSAAAAAFUAAAAAAAEADXF1ZXJ5X3Jld3JpdGUADXJld3JpdGVfcnVsZXMA
CAMPDw/+Dw8PDiBOUAAgTvcBoA8AAZAB5AEBAAIJLgT8/wAF/P8ABFoCaWQHcGF0dGVybhBwYXR0
ZXJuX2RhdGFiYXNlC3JlcGxhY2VtZW50B2VuYWJsZWQHbWVzc2FnZQ5wYXR0ZXJuX2RpZ2VzdBJu
b3JtYWxpemVkX3BhdHRlcm4KAS4GCAIDWUVTAk5PCAEADAH/Sxp+LA==
YB0YZx4BAAAAngAAAOoSAAAAAFUAAAAAAAEAAgAI/+AFAAAAKwBTRUxFQ1QgKiBGUk9NIHRhYmxl
X25hbWUgV0hFUkUgY29sX25hbWUgPSA/B2RiX25hbWU+AFNFTEVDVCAqIEZST00gdGFibGVfbmFt
ZSBGT1JDRSBJTkRFWChpZHhfMSkgV0hFUkUgY29sX25hbWUgPSA/Ae47hS4=
'/*!*/;
### INSERT INTO `query_rewrite`.`rewrite_rules`
### SET
### @1=5 /* INT meta=0 nullable=0 is_null=0 */
### @2='SELECT * FROM table_name WHERE col_name = ?' /* VARSTRING(20000) meta=20000 nullable=0 is_null=0 */
### @3='db_name' /* VARSTRING(80) meta=80 nullable=1 is_null=0 */
### @4='SELECT * FROM table_name FORCE INDEX(idx_1) WHERE col_name = ?' /* VARSTRING(20000) meta=20000 nullable=0 is_null=0 */
### @5=1 /* ENUM(1 byte) meta=63233 nullable=0 is_null=0 */
### @6=NULL /* VARSTRING(4000) meta=4000 nullable=1 is_null=1 */
### @7=NULL /* VARSTRING(256) meta=256 nullable=1 is_null=1 */
### @8=NULL /* VARSTRING(400) meta=400 nullable=1 is_null=1 */
# at 4842
#241022 14:47:12 server id 1 end_log_pos 4873 CRC32 0x81731bb2 Xid = 54
COMMIT/*!*/;
# at 4873
#241022 14:47:14 server id 1 end_log_pos 4952 CRC32 0x89813169 Anonymous_GTID last_committed=7 sequence_number=8 rbr_only=yes original_committed_timestamp=1729633634456628 immediate_commit_timestamp=1729633634456628 transaction_length=733
/*!50718 SET TRANSACTION ISOLATION LEVEL READ COMMITTED*//*!*/;
# original_commit_timestamp=1729633634456628 (2024-10-22 14:47:14.456628 PDT)
# immediate_commit_timestamp=1729633634456628 (2024-10-22 14:47:14.456628 PDT)
/*!80001 SET @@session.original_commit_timestamp=1729633634456628*//*!*/;
/*!80014 SET @@session.original_server_version=90000*//*!*/;
/*!80014 SET @@session.immediate_server_version=90000*//*!*/;
SET @@SESSION.GTID_NEXT= 'ANONYMOUS'/*!*/;
# at 4952
#241022 14:47:14 server id 1 end_log_pos 5030 CRC32 0x83c854a6 Query thread_id=21 exec_time=0 error_code=0
SET TIMESTAMP=1729633634/*!*/;
BEGIN
/*!*/;
# at 5030
#241022 14:47:14 server id 1 end_log_pos 5241 CRC32 0x7501e3a2 Table_map: `query_rewrite`.`rewrite_rules` mapped to number 85
# has_generated_invisible_primary_key=0
# at 5241
#241022 14:47:14 server id 1 end_log_pos 5527 CRC32 0xca95f6e3 Update_rows: table id 85 flags: STMT_END_F
BINLOG '
Yh0YZxMBAAAA0wAAAHkUAAAAAFUAAAAAAAEADXF1ZXJ5X3Jld3JpdGUADXJld3JpdGVfcnVsZXMA
CAMPDw/+Dw8PDiBOUAAgTvcBoA8AAZAB5AEBAAIJLgT8/wAF/P8ABFoCaWQHcGF0dGVybhBwYXR0
ZXJuX2RhdGFiYXNlC3JlcGxhY2VtZW50B2VuYWJsZWQHbWVzc2FnZQ5wYXR0ZXJuX2RpZ2VzdBJu
b3JtYWxpemVkX3BhdHRlcm4KAS4GCAIDWUVTAk5PCAEADAH/ouMBdQ==
Yh0YZx8BAAAAHgEAAJcVAAAAAFUAAAAAAAEAAgAIPvAQKwBTRUxFQ1QgKiBGUk9NIHRhYmxlX25h
bWUgV0hFUkUgY29sX25hbWUgPSA/B2RiX25hbWU+AFNFTEVDVCAqIEZST00gdGFibGVfbmFtZSBG
T1JDRSBJTkRFWChpZHhfMSkgV0hFUkUgY29sX25hbWUgPSA/AQIBQAAwNGQ3NjIxNTY1MTYxYjgy
ZGYxMTMwYmMxOGJhZmExYWY0Nzc1Y2VhNjRkNjUzNzk1OWIwN2UyYjdhOTY1NzNiPQBzZWxlY3Qg
YCpgIGZyb20gYGRiX25hbWVgLmB0YWJsZV9uYW1lYCB3aGVyZSAoYGNvbF9uYW1lYCA9ID8p4/aV
yg==
'/*!*/;
### UPDATE `query_rewrite`.`rewrite_rules`
### WHERE
### @2='SELECT * FROM table_name WHERE col_name = ?' /* VARSTRING(20000) meta=20000 nullable=0 is_null=0 */
### @3='db_name' /* VARSTRING(80) meta=80 nullable=1 is_null=0 */
### @4='SELECT * FROM table_name FORCE INDEX(idx_1) WHERE col_name = ?' /* VARSTRING(20000) meta=20000 nullable=0 is_null=0 */
### @5=1 /* ENUM(1 byte) meta=63233 nullable=0 is_null=0 */
### @6=NULL /* VARSTRING(4000) meta=4000 nullable=1 is_null=1 */
### SET
### @5=1 /* ENUM(1 byte) meta=63233 nullable=0 is_null=0 */
### @6=NULL /* VARSTRING(4000) meta=4000 nullable=1 is_null=1 */
### @7='04d7621565161b82df1130bc18bafa1af4775cea64d6537959b07e2b7a96573b' /* VARSTRING(256) meta=256 nullable=1 is_null=0 */
### @8='select `*` from `db_name`.`table_name` where (`col_name` = ?)' /* VARSTRING(400) meta=400 nullable=1 is_null=0 */
# at 5527
#241022 14:47:14 server id 1 end_log_pos 5606 CRC32 0x3d0b35b1 Query thread_id=21 exec_time=0 error_code=0
SET TIMESTAMP=1729633634/*!*/;
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*/;