Skip to content

fix: a microbatch rebuild left by a failed run is rebuilt, never published - #1731

Queued
kvlonge wants to merge 2 commits into
mainfrom
fix/microbatch-partial-rebuild
Queued

kvlonge wants to merge 2 commits into
mainfrom
fix/microbatch-partial-rebuild

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Why

A microbatch first build or --full-refresh builds into a rebuild relation and swaps it in after the last batch. When a later batch failed, the next build found the rebuild relation with no live table and renamed it to the live name, as if a swap had been interrupted. If that build failed again, the model was left holding only the batches before the failure. The next run was then planned as incremental and refilled only its lookback window, so older missing batches stayed missing.

Changes

  • The next build drops a leftover rebuild relation and starts from the first batch. It never promotes it, because nothing records whether a rebuild is complete.
  • A swap interrupted on an adapter without transactional DDL now costs one rebuild and keeps the previous generation; the old rename went on to drop it at promotion.
  • The failed run still keeps the rebuild relation for inspection.

DuckShop: no edge case added. The sequence needs a model that fails on purpose, and DuckShop's build must stay green.

Verification

  • New e2e: the fourth of five batches fails the first build; the next build fails again and publishes no table (on main it publishes batches 1 to 3); once the SQL is fixed the build writes every batch once. It fails on main.
  • Microbatch integration and e2e tests pass.

…ished

A microbatch first build or full refresh builds aside into a rebuild
relation and swaps it in once every batch has run. When a later batch
failed, the rebuild relation stayed behind for inspection. The next
build found it without a live table, took it for an interrupted swap and
renamed it to the live name, publishing the batches before the failure
as the model. Later incremental runs then never filled the batches that
were missing.

A rebuild relation records nothing that says it is complete, so the
next build now always drops it and starts again from the first batch. A
swap interrupted on an adapter without transactional DDL costs one
rebuild; the previous generation is kept.
@kvlonge
kvlonge enabled auto-merge November 30, 2026 14:06
Checking the cached relation listing first keeps a full refresh with no
leftover rebuild at its earlier statement count.
@kvlonge
kvlonge added this pull request to the merge queue Nov 30, 2026
Any commits made after this event will not be merged.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant