You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(mysql): pull INVISIBLE/GIPK columns during snapshot (#4553)
## Problem
MySQL/MariaDB QRep snapshot took a `SELECT *` fast path in
`buildSelectedColumns`. Wildcard expansion **omits INVISIBLE columns** —
including the generated invisible primary key (`my_row_id`) from
`sql_generate_invisible_primary_key`. But the destination table (created
from `information_schema.columns`) and CDC (binlog row images) both
**include** those columns.
Result: snapshot rows keep destination defaults forever while CDC
populates real values — silent divergence. Worst case is GIPK, where the
invisible `my_row_id` is the table's only PK, so snapshot rows arrive
with no key, breaking dedup/ordering.
## Fix
Always build an explicit column list from the fetched table schema (drop
the `SELECT *` fast path). The schema already contains invisible/GIPK
columns, and naming them explicitly bypasses wildcard invisibility, so
the snapshot pulls them — matching CDC and the destination DDL.
## Tests
- Unit: `buildSelectedColumns` never returns `*`; invisible/GIPK columns
are listed explicitly.
- E2E (`clickhouse_mysql_test.go`):
`Test_MySQL_Invisible_Column_Consistency` and
`Test_MySQL_GIPK_Consistency` compare snapshot vs CDC values
(version-gated; GIPK is MySQL-only).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments