Skip to content

adapter: plan builtin schema migrations from dev versions by fingerprint - #39716

Draft
ggevay wants to merge 1 commit into
MaterializeInc:mainfrom
ggevay:gabor/sql-663-dev-builtin-migrations
Draft

ggevay wants to merge 1 commit into
MaterializeInc:mainfrom
ggevay:gabor/sql-663-dev-builtin-migrations

Conversation

@ggevay

@ggevay ggevay commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Prototype, opened as a draft. Not ready for review: it exists so SQL-652 and SQL-663 can point at working code.

Motivation

Upgrades from a dev build cannot select builtin migration steps by version, because dev builds share version strings. At an equal version string the migration is skipped entirely (SQL-663), and at a different one every builtin is evolved in place, ignoring Replacement steps (SQL-652). An incompatible builtin schema change then crashes environmentd. #39597 retypes two columns of mz_materialized_view_refresh_strategies, which makes both failures deterministic.

Change

  • For a dev source, plan exactly the builtins whose stored fingerprint differs from the current one: Evolution where persist accepts the new schema, Replacement otherwise. Return early only when that plan is empty.
  • Replacement shards are recorded per (object, version, deploy generation), so a second dev build at the same version would get back the first build's entry, which names the live shard. Such an entry is now retracted and a fresh shard allocated.

Tests

Two turmoil tests in builtin_schema_migration_tests.rs: dev sources at an equal and at an older version string, and a repeated replacement at the same version.

Not covered yet: dev upgrades under 0dt (a read-only boot, then promotion).

🤖 Generated with Claude Code

Dev builds share version strings, so migration steps cannot be selected by
version when upgrading from a dev build. Plan exactly the builtins whose
fingerprint changed instead: evolve where persist accepts the new schema,
replace otherwise. Also stop reusing a same-version replacement entry that
names the shard the builtin already uses.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

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