Repository navigation
feat(build)!: rename maintained models to dynamic and close their hold gaps - #1594
Merged
Merged
Conversation
…duals - A model created during a build now runs the same earliest-hold check as acquire once its pause is recorded, so two builds creating the same model no longer both hold it. Our create made the model active, so it is suspended either way; the build holding it resumes it at its end, and a build that backed out resumes it itself at its end when no other build holds it, so a model never stays suspended after both back out. - When the losing build cannot close its own pause, the A718 error now names that failure too instead of being replaced by it. - Pauses are ordered by the warehouse clock when each insert starts, but an insert commits later. A build now also backs out for a rival that paused within the time its own insert took, since that rival may have read the table before our pause committed, and when a takeover closed its pause before it read the table back. Two builds that start at the same moment can both stop with A718; neither builds alongside the other. - A snapshot's first build and full rebuild turn change tracking on when a maintained model reads it, as table builds already do (new optional render_track_changes adapter method; Snowflake runs ALTER TABLE ... SET CHANGE_TRACKING = TRUE). - The planner's change check drops refresh_mode when it is the default, on both the recorded and the current side, so writing out or removing the default no longer recreates the model. Stored-status hashes are unchanged.
The model kind is now called dynamic everywhere: `materialized dynamic`, the `[dynamic]` project section (still `heartbeat_grace` and `allow_ignore_grace`), the `pause_dynamic` target setting, the `--ignore-dynamic-grace` build flag, the `_sqlbuild_dynamic_pauses` state table, plan actions and wording, error text, the Dynamic models docs page and the tests. Error codes are unchanged. BREAKING CHANGE: `materialized maintained`, `[maintained]`, `pause_maintained` and `--ignore-maintained-grace` are no longer accepted; use `materialized dynamic`, `[dynamic]`, `pause_dynamic` and `--ignore-dynamic-grace`. The materialization is part of a model's version identity, so each existing model is recreated once, with a full recompute, by its first build after the rename. Builds record pauses in `_sqlbuild_dynamic_pauses` and no longer read `_sqlbuild_maintained_pauses`: let builds on the previous version finish before upgrading, resume by hand any model a killed older build left suspended, then drop the old table.
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.
Why
Maintained models shipped with known gaps: two builds creating the same model could both hold it, a failed close hid A718, a late-committing pause could let two builds run together, a snapshot full rebuild dropped change tracking, and writing out the default
refresh_moderecreated the model. The kind is also renamed to dynamic before more projects adopt it.Changes
after_createruns the same earliest-hold check as acquire. A build that backs out after suspending a model it created resumes it at its end when no other build holds it. A failed close is reported inside A718.refresh_mode; stored-status hashes are unchanged.materialized dynamic,[dynamic],pause_dynamic,--ignore-dynamic-grace,_sqlbuild_dynamic_pauses, plan wording, errors, the Dynamic models page. No aliases. Each existing model is recreated once on upgrade; the old pause table is no longer read.Residual risk: after a create race, the backed-out build leaves the model suspended and unheld until it ends. No DuckShop case: dynamic models build only on Snowflake.
Verification
refresh_mode incrementaladd/remove kept the table; a 0.251.0 project upgraded with one recreate, then kept.make test,make check-ci; one review plus follow-up.