Skip to content

Musicbrainz schema update v32 - #30

Open
frisi wants to merge 3 commits into
acoustid:mainfrom
molindo:MD-137-schema-update-v32
Open

frisi wants to merge 3 commits into
acoustid:mainfrom
molindo:MD-137-schema-update-v32

Conversation

@frisi

@frisi frisi commented Oct 1, 2026 •

Copy link
Copy Markdown

this updates to the newest schema released 2026-09-21

see https://blog.metabrainz.org/2026/09/21/musicbrainz-server-update-2026-09-21/ for details.

note that i had to comment out migrations for the sitemaps schema as we don't install this in mbslave (see separate commit)

update:

our replications failed with an error psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "recording_tag_pkey" and i thought the schema update caused the error.

turned out we were using an outdated version of mbslave that did not DISABLE TRIGGER on imports.
as of today (2026-10-02 the replication packages still have SCHEMA_SEQUENCE set to 31 so updating the database as suggested in this readme would fail with

mbslave.replication.MismatchedSchemaError: Mismatched schema sequence, 32 (database) vs 31 (replication packet)

so for the time being, better not merge this. but maybe keep the pr open until musicbrainz starts to send replication packages with the updated schema version.

Harald Friessnegger added 3 commits October 1, 2026 10:31
seems the sitemap schema is not supported by mbslave and not included in
`mbslave.replication.create_schemas`
@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 9522e7d5-3e0a-44c1-a9ce-333ce9fa775d

📥 Commits

Reviewing files that changed from the base of the PR and between be87344 and 49c3f80.

📒 Files selected for processing (20)
  • CHANGELOG.rst
  • README.rst
  • mbslave/__init__.py
  • mbslave/sql/CreateFunctions.sql
  • mbslave/sql/CreateIndexes.sql
  • mbslave/sql/CreateTables.sql
  • mbslave/sql/CreateTriggers.sql
  • mbslave/sql/CreateViews.sql
  • mbslave/sql/DropFunctions.sql
  • mbslave/sql/DropIndexes.sql
  • mbslave/sql/DropTables.sql
  • mbslave/sql/DropTriggers.sql
  • mbslave/sql/TruncateTables.sql
  • mbslave/sql/sitemaps/CreateIndexes.sql
  • mbslave/sql/sitemaps/DropIndexes.sql
  • mbslave/sql/updates/20251211-drop-old-editor-name.sql
  • mbslave/sql/updates/20260602-new-sitemaps-indexes.sql
  • mbslave/sql/updates/20260623-mbs-12379.sql
  • mbslave/sql/updates/20260723-mbs-14386.sql
  • mbslave/sql/updates/schema-change/32.all.sql
💤 Files with no reviewable changes (7)
  • mbslave/sql/CreateTables.sql
  • mbslave/sql/TruncateTables.sql
  • mbslave/sql/DropTriggers.sql
  • mbslave/sql/CreateTriggers.sql
  • mbslave/sql/DropFunctions.sql
  • mbslave/sql/DropTables.sql
  • mbslave/sql/CreateFunctions.sql

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

The schema 32 release removes old editor-name objects, adds indexes, and replaces the series_series view. It also updates the package version, changelog, and schema upgrade instructions.

Changes

Schema 32 release

Layer / File(s) Summary
Remove old editor-name objects
mbslave/sql/CreateFunctions.sql, mbslave/sql/CreateTables.sql, mbslave/sql/CreateTriggers.sql, mbslave/sql/CreateIndexes.sql, mbslave/sql/DropFunctions.sql, mbslave/sql/DropIndexes.sql, mbslave/sql/DropTables.sql, mbslave/sql/DropTriggers.sql, mbslave/sql/TruncateTables.sql, mbslave/sql/updates/20251211-drop-old-editor-name.sql, mbslave/sql/updates/schema-change/32.all.sql
Removes the old_editor_name table, its unique index, and the check_editor_name trigger and function from schema and cleanup scripts. Adds an update that drops those objects.
Add and manage indexes
mbslave/sql/CreateIndexes.sql, mbslave/sql/DropIndexes.sql, mbslave/sql/sitemaps/*, mbslave/sql/updates/20260602-new-sitemaps-indexes.sql, mbslave/sql/updates/20260623-mbs-12379.sql, mbslave/sql/updates/schema-change/32.all.sql
Adds indexes on editor and annotation-related columns and on the seven sitemap lastmod tables. The generated migration includes the editor and annotation indexes; sitemap index statements appear inside a block comment.
Replace series relationship view
mbslave/sql/CreateViews.sql, mbslave/sql/updates/20260723-mbs-14386.sql, mbslave/sql/updates/schema-change/32.all.sql
Changes the link-type GID used by series_series and adds a view definition that selects series relationship data, text values, and link order.
Document schema 32 release
CHANGELOG.rst, README.rst, mbslave/__init__.py
Adds the schema 32 changelog entry and upgrade instructions, and changes the package version to 32.0.0.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to 49c3f

The schema 32 changes are consistent with the documented upgrade path, including intentionally excluding unsupported sitemap migrations. No actionable merge-blocking risk is established; merge after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 49c3f

The reviewed changes are bounded to an operator-managed database replica. The migration is transactional, the relationship view preserves its columns, and current editor-name uniqueness remains enforced. No introduced security vulnerability was established, but deployed permissions, external consumers, and custom writable deployments remain unverified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The evidenced change scope is the replica database selected by the operator: its historical-name records, query indexes, and series relationship projection. This does not establish exposure of an upstream account-registration service or additional tenants or environments.

Trust Boundaries and Controls

  • observed — The two routed public-entrypoint ranges contain fixed index DDL, not callable functions or network endpoints. The aggregate migration contains no GRANT or REVOKE statements. These declarations do not themselves demonstrate expanded attacker authority; effective database permissions remain deployment-dependent.

Hardening Proposals

  • proposed — For stronger upgrade containment, serialize operator upgrades and gate schema-sequence publication on successful migration completion. Treat this as hardening of the existing manual upgrade process, not a newly established vulnerability.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the MusicBrainz schema update to version 32, which is the main change in the pull request.
Description check ✅ Passed The description explains the schema update, the excluded sitemap migrations, the replication-version mismatch, and the reason to delay merging.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

DROP TABLE IF EXISTS old_editor_name CASCADE;

--------------------------------------------------------------------------------
/* disabled sitemaps schema related updates, as this seems not to be installed with mbdata

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

migration fails with

running the upgrade fails with

 20260602-new-sitemaps-indexes.sql
(1 row)

psql:/tmp/tmpz8yymk5b.sql:22: ERROR:  schema "sitemaps" does not exist

as we don't install this schema in mbslave.replication.create_schemas

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