julien-duponchelle / python-mysql-replication

Pure Python Implementation of MySQL replication protocol build on top of PyMYSQL
2.31k stars 678 forks source link

Fix an issue in parsing default column charset #582

Closed YAtOff closed 9 months ago

YAtOff commented 9 months ago

Description

When parsing the default charset optional metadata, when handling the column index/collation number pairs, the column index is in the range of the number of columns with charset (not the number of all the columns). Like how it's done here: https://github.com/ClickHouse/ClickHouse/blob/001b67863a57c4d734d94e375e6fdeb4a9407951/src/Core/MySQL/MySQLReplication.cpp#L353

Type of Change

sean-k1 commented 9 months ago

@YAtOff Really Cool Pr! Thanks a lot for spotting that issue and fixing it! It seems like I didn't realize that the keys of 'column_charset_collation' were the order of non-numeric columns while handling that logic.

Can you describe your mysql variable? for history

and Can you fix lint too?

 black pymysqlreplication
YAtOff commented 9 months ago

MySQL variables

Name Value
binlog_format ROW
binlog_row_image FULL
binlog_row_metadata MINIMAL
binlog_row_value_options -