Repository navigation
Add a builtin schema migration step to finalize shards - #40898
Open
SangJunBak wants to merge 2 commits into
Open
SangJunBak wants to merge 2 commits into
SangJunBak wants to merge 2 commits into
Conversation
SangJunBak
force-pushed
the
jun/builtin-view-migration
branch
from
November 18, 2026 22:01
de5d7b3 to
dbcb891
Compare
…e durable catalog - In the durable catalog via migrate.rs, we change the catalog's system mapping of any builtin relation that wants to go from a table/mv to a view. A followup change is making sure that the shard is cleaned up via a builtin schema migration. - In open.rs, we remove a stale comment because it predates our builtin schema migration and it's now possible to convert a table to a view in stable schemas. The assertion below where the comment panics if we try to remove an object in a stable schema. This doesn't trigger because we're mutating the type of the object in place rather than deleting/adding it.
The new MigrationStep::Drop allows us to drop the shard when converting a table/mv into a view. It does this by looking at the builtin items to drop, then adds it to the unfinalized shards queue. For forced migrations, although there isn't an explicit one for Drop, we still clean up shards that are associated with views.
SangJunBak
force-pushed
the
jun/builtin-view-migration
branch
from
November 18, 2026 23:01
dbcb891 to
1da0c53
Compare
This branch has not been deployed
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.
We add MigrationStep::Drop such that we can convert builtin materialized views and tables to views and clean up any stray shards. This will be used to migrate our builtin function and type relations.
See commit messages for details, but it essentially sees if these converted relations have shards then adds it to the
unfinalized_shardsinside the migration transaction.A simpler solution could've been something like:
And this could've been done in
migrate.rs. However, it seemed cleaner to add it to the existing framework.Motivation
Because we're trying to reduce the number of materialized views, we provide a way to drop them and convert them into views with this PR.
Verification
builtin_schema_migration_tests.rssuch that a migration results in the correct results inunfinalized_shards, the queue of shards to finalize. I figured it wasn't worth refactoring our current random turmoil test for this because the functionality doesn't do any intermediate persist work.