Repository navigation
Read buffered rows with the right table definition - #365
Conversation
AI review gate — AI review passedClean review from: Cursor Bugbot. |
There was a problem hiding this comment.
Auto-approved by the AI review gate on ed6fe37. Details in the approver's comment on this pull request.
AI review gate — auto-approved
History (latest 5 heads, newest first)
|
Buffered rows could use the table definition at commit even if they were written before a schema change. Use each row's WAL position to look up its saved definition, including after restart. Track missed catalog reads per table and allow later reads to continue. Fill gaps where a later definition can safely read earlier rows, and stop when no safe definition exists. This preserves new column values in ClickHouse when a second ADD COLUMN goes unread.
The 64-read and 10-second replay wait limits could skip a table definition needed by buffered rows and stop replication. Remove both per-transaction limits. Before sending WAL past a DDL command, look ahead in buffered WAL. Skip the catalog read only when a later read covers the same tables and no row needs the intermediate definition. Catalog-only migrations can use a single commit read. If the available WAL leaves any doubt, read at the current boundary.
62a34f8
ed6fe37 to
62a34f8
Compare
There was a problem hiding this comment.
Auto-approved by the AI review gate on 62a34f8. Details in the approver's comment on this pull request.
Read buffered rows with the right table definition
Buffered rows could use the table definition at commit even if they
were written before a schema change. Use each row's WAL position to
look up its saved definition, including after restart.
Track missed catalog reads per table and allow later reads to continue.
Fill gaps where a later definition can safely read earlier rows, and
stop when no safe definition exists. This preserves new column values
in ClickHouse when a second ADD COLUMN goes unread.
Read table definitions only when WAL needs them
The 64-read and 10-second replay wait limits could skip a table
definition needed by buffered rows and stop replication.
Remove both per-transaction limits. Before sending WAL past a DDL
command, look ahead in buffered WAL. Skip the catalog read only when
a later read covers the same tables and no row needs the intermediate
definition. Catalog-only migrations can use a single commit read.
If the available WAL leaves any doubt, read at the current boundary.
Note
High Risk
Changes core catalog capture, descriptor timeline construction, and commit-time row decoding—incorrect gap filling or skip logic could mis-decode schema changes or stall replication.
Overview
Command-boundary catalog capture no longer degrades whole transactions via per-xact read caps or hold budgets. Failed or skipped reads are recorded as per-table misses, name-refresh events handle cache flushes, and
timeline::buildassembles WAL-ordered descriptor history at commit—fencing gaps only whencompatible_readercannot bridge them.The WAL pump lookahead in
wal_streamtracks row touches between command boundaries and can skip a shadow read when buffered WAL shows no heap rows need that definition before a later covering read.BoundaryInfocarriespreceding_rows/following_rowsfor that decision; metrics addpending_skipped.Buffered row decoding no longer depends on provisional
PendingCatalogat drain time:DescriptorLog::rfn_historysupplies per-LSN descriptors (including after restart), withStashUncoveredwhen none exists. Configpending_max_*and related degrade reasons are removed; docs/plans and e2e tests move tofail_command_read_afterfor forced misses.Reviewed by Cursor Bugbot for commit 62a34f8. Bugbot is set up for automated code reviews on this repo. Configure here.