source-mysql v10: preserve saved schema history so column additions don't break CDC - #131
source-mysql v10: preserve saved schema history so column additions don't break CDC#131tanishq171 wants to merge 1 commit into
Conversation
…on't break CDC The v7 schema-history rebuild unconditionally replaced the saved history with a fresh snapshot from live SHOW CREATE TABLE. That breaks in-place schema evolution: when a column is added on the source, the rebuild seeds the connector with the current (post-ALTER) N-column shape, but the connector resumes from a saved binlog offset that predates the ALTER. Debezium then validates old, pre-ALTER row events (N-1 columns) against the rebuilt N-column schema and aborts with 'internal schema size N, but row size N-1, restart connector with schema recovery mode' instead of auto-propagating the new column. v10 keeps the saved schema history whenever it is non-empty, letting Debezium replay the ALTER DDL from the binlog at its correct position and evolve the schema in lockstep (stock behavior). The SHOW CREATE TABLE rebuild now runs only when there is no saved history to resume from. Trade-off: a non-empty-but-incomplete history (a table missing after a swap + retention gap) is no longer force-rebuilt. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
👋 Welcome to Airbyte!Thank you for your contribution from browserstack/airbyte! We're excited to have you in the Airbyte community. If you have any questions, feel free to ask in the PR comments or join our Slack community. 💡 Show Tips and TricksPR Slash CommandsAs needed or by request, Airbyte Maintainers can execute the following slash commands on your PR:
Tips for Working with CI
📚 Show Repo GuidanceHelpful Resources
|
|
What
v10 of the patched source-mysql connector: preserve the saved Debezium schema history instead of unconditionally rebuilding it, so adding a column to a source table no longer breaks CDC. Built on v9 (
source-mysql-gtid-patch-v9, the PR base) — this is the single schema-history commit on top of it.Why
The v7 schema-history rebuild replaces the saved history with a fresh snapshot from live
SHOW CREATE TABLEon every warm start. When a column is added on the source, that seeds the connector with the current (post-ALTER, N-column) shape, but the connector resumes from a saved binlog offset that predates the ALTER. Debezium then validates old, pre-ALTER row events (N-1 columns) against the rebuilt N-column schema and aborts:Observed on testhub-015 → btcer (
build_test_case_execution_results), job 18847: the rebuild jumped btcer to 83 columns while the connector was ~620 binlog files behind, so the first pre-ALTER 82-column row killed the sync — instead of Airbyte's normal auto-propagation of the new column.The change
MySqlSourceDebeziumOperations.validate(): keepdebeziumState.schemaHistorywhen non-empty; fall back to theSHOW CREATE TABLErebuild only when there is no saved history to resume from. This lets Debezium replay theALTER … ADD COLUMNfrom the binlog at its correct position and evolve the schema in lockstep — the stock behavior the v7 rebuild was clobbering.Verification
spec):tanishq171/source-mysql:3.52.3-gtid-patch-v10(linux/amd64), digestsha256:ab2d029b392c9f062566f5970e658dab6c2279b98e81ecf4e22eaaebb0a11bcf.Trade-off
The rebuild now runs only for empty history, so a non-empty-but-incomplete history (a table missing after a master/replica swap + retention gap — v7's original target) is no longer force-rebuilt. Accepted here in favor of not breaking column additions; revisit with a per-table merge if the swap case resurfaces.
🤖 Generated with Claude Code