mysql: convert BIT to UInt64 in binary type path for new mirrors#4423
Merged
Conversation
The binary binlog/QRep type conversion (qkindFromMysqlType) mapped BIT to Int64, while the information_schema text path (QkindFromMysqlColumnType) already mapped it to UInt64. This left BIT columns discovered via the binary path inconsistent with the rest of the system — most visibly gh-ost/TABLE_MAP_EVENT-detected columns and QRep watermark/fallback paths. Gate the new UInt64 mapping behind InternalVersion_MySQLConvertBitToUInt64 so existing mirrors keep their previously-materialized destination column type, and only new mirrors get the consistent UInt64 behavior. Thread the mirror version through qkindFromMysqlType / QRecordSchemaFromMysqlFields and their callers (CDC, QRep, e2e helper). Add a unit test covering the gate. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
ilidemi
approved these changes
Jun 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
qkindFromMysqlType(the binary binlog / QRep type-conversion path) mapped MySQLBITtoInt64, whileQkindFromMysqlColumnType(theinformation_schema/ DDL text path) already mapped it toUInt64. This madeBITcolumns that flow through the binary path inconsistent with the rest of the system.The binary path is reached for:
TABLE_MAP_EVENTwithout a captured DDL event (e.g. gh-ost / online-schema-change migrations) —processTableMapEventSchemaQRecordSchemaFromMysqlFieldsfallback for columns absent from the table schemaA plain
ALTER TABLE ... ADD COLUMN bit(...)is not affected — it's captured as a DDL query event and already routes through theUInt64text path.Change
BITtoUInt64inqkindFromMysqlType, gated behind a newInternalVersion_MySQLConvertBitToUInt64.qkindFromMysqlType/QRecordSchemaFromMysqlFieldsand their callers (CDC, QRep, e2e helper).Why gate it
The destination column type is fixed when a column is first created. An existing mirror that already materialized a
BITcolumn asInt64via the binary path would break if the code started emittingUInt64values into thatInt64column on upgrade (schema deltas add columns, they don't retype existing ones). Gating onInternalVersionkeeps existing mirrors on their previous behavior and gives only new mirrors the consistentUInt64mapping.Testing
TestQkindFromMysqlType_BitassertsInt64below the gate version andUInt64at/above it.go build ./...and theconnectors/mysqlunit tests pass.🤖 Generated with Claude Code