osheroff / mysql-binlog-connector-java

MySQL Binary Log connector
680 stars 167 forks source link

MYSQL_TYPE_VAR_STRING handling in binlog protocol #151

Open megatron10 opened 3 months ago

megatron10 commented 3 months ago

As per Mysql code bsae comments/docs MYSQL_TYPE_VAR_STRING can be used for both Strings and Enum types. The connector code has special handling for checking if MYSQL_TYPE_STRING is actually an Enum instead, but there is no such handling for MYSQL_TYPE_VAR_STRING.

Mysql codebase reference point: https://github.com/mysql/mysql-server/blob/596f0d238489a9cf9f43ce1ff905984f58d227b6/libs/mysql/binlog/event/rows_event.h#L371

Connector code base type code handling: https://github.com/osheroff/mysql-binlog-connector-java/blob/master/src/main/java/com/github/shyiko/mysql/binlog/event/deserialization/AbstractRowsEventDataDeserializer.java#L126

An underlying Enum column with MYSQL_TYPE_VAR_STRING type in the table map will be treated as string, when infact its an Enum.