MusicBrainz schema change release, 2024-05-13 (with upgrade instructions)

We’re happy to announce the release of our May 2024 schema change now! Thanks to all who were patient during yesterday’s downtime as we released everything to our production servers. Final testing for the mirrors also took some more time. Note that the initially announced upgrades for MusicBrainz search engine are just about to reach our beta website, and thus are postponed for mirrors too but can be expected for the few next releases.

This is a fairly small schema change release which mostly removes unused code and improves things behind the scenes. Of the schema change tickets, there are only two that will directly affect users as they browse and edit in MusicBrainz. The first (MBS-13421) adds genre collections, so that editors can for example make a list of their favorite genres. The second (MBS-13514) allows entering 6-digit label codes.

Additionally, derat gratified us with making aliases more visible in the website, and some other improvements, while yellowhatpro polished cover art priority.

Thanks to chaban, cyberskull, thomasegger, Toad King, and wileyfoxyx for having reported bugs and suggested improvements. Thanks to 0x1026, Anonymous, “ApeKattQuest, MonkeyPython”, AshPigeon, Autom, brtc, chaban, claybiockiller, danBLOO, darlingz, eigenric, Evergarden, GABG, hashflu, hesheng, julian45, kellnerd, LiarOnce, Philipp Wolfer, salo.rock, suming, Vac31., wileyfoxyx, x1ao4, xiaole_0714223, yangmouren, yyb987, and zemeles for updating the translations. And thanks to all others who tested the beta version!

A new release of MusicBrainz Docker is also available that matches this update of MusicBrainz Server. See the release notes for update instructions.

Now, on to the instructions if you’re not using MusicBrainz Docker.

Schema Change Upgrade Instructions

Note: Importing the latest data dump is always a valid alternative to running ./upgrade.sh on an existing database, if you’d prefer to also get new data in one go. Just follow the relevant instructions in INSTALL.md. The git tag is v-2024-05-13-schema-change. The rest of the instructions here assume an in-place upgrade.

  1. Make sure DB_SCHEMA_SEQUENCE is set to 28 in lib/DBDefs.pm.
  2. If you’re using the live data feed (your REPLICATION_TYPE is set to RT_MIRROR), ensure you’ve replicated up to the most recent replication packet available with the old schema. If you’re not sure, run ./admin/replication/LoadReplicationChanges and see what it tells you; if you’re ready to upgrade, it should say “This replication packet matches schema sequence #29, but the database is currently at #28.”
  3. Take down the web server running MusicBrainz, if you’re running a web server.
  4. Turn off cron jobs if you’re automatically updating the database via cron jobs.
  5. Upgrade PostgreSQL to version 16 (see instructions in the subsection below).
  6. Install Perl 5.38 (perlbrew can be used if 5.38 isn’t packaged for your system).
  7. Switch to the new code with git fetch origin followed by git checkout v-2024-05-13-schema-change.
  8. Run cpanm --installdeps --notest . (note the dot at the end) to ensure your perl-based dependencies are up to date.
  9. Run ./upgrade.sh (it may take a while to vacuum at the end).
  10. Set DB_SCHEMA_SEQUENCE to 29 in lib/DBDefs.pm as instructed by the output of ./upgrade.sh.
  11. Turn cron jobs back on, if applicable.
  12. Restart the MusicBrainz web server, if applicable. If you’re accessing your MusicBrainz server in a web browser, run ./script/compile_resources.sh.

Upgrade PostgreSQL to version 16

Install packages for PostgreSQL 16. On Ubuntu/Debian you can obtain them from the PGDG apt repo.

apt-get update && \
apt-get install postgresql-16 postgresql-server-dev-16

If you’re installing postgresql-16 for the first time, this will automatically create a new cluster at /var/lib/postgresql/16/main. Remove that empty cluster. Don’t run this if you already had v16 installed and have data there!

pg_dropcluster --stop 16 main

If you did already have v16 installed with musicbrainz_db running there, leave the cluster alone and skip the next step involving pg_upgradecluster.

In the unlikely event that you already have a v16 cluster, but also have musicbrainz_db running in a separate, older cluster, these instructions won’t work for you. We recommend importing fresh data dumps into the v16 cluster and dropping the old one.

Then, upgrade the old cluster. This assumes it’s version 12; if you’re using a different intermediate version replace 12 below with your version. If you have other databases in your old cluster besides musicbrainz_db, be aware that this will upgrade all of them to PG 16.

 pg_upgradecluster -v 16 12 main

If all goes well, the new cluster should be up and running. You can drop the old one if you like; the output of the pg_upgradecluster command will tell you how.

Go back to the step 6. for the rest of the Schema Change Upgrade instructions.

That’s all for the upgrade instructions. Here’s the list of resolved tickets:

Fixed Bug

  • [MBS-13514] – Cannot add 6-digit Label Code
  • [MBS-13541] – Relationship editor should accept uppercase MBIDs

New Feature

  • [MBS-7646] – Show alias next to entity name in search and relations

Improvement

  • [MBS-11962] – Update privileges for all database users on schema changes
  • [MBS-13421] – Add genre collections
  • [MBS-13533] – Release group pages should prioritize non-bootleg album art
  • [MBS-13539] – Update VK logo
  • [MBS-13540] – Further refine logic for updating credits on tracks with featured artists
  • [MBS-13546] – Replace Email::Address with Email::Address::XS
  • [MBS-13548] – Obey “returnto” for already logged in users
  • [MBS-13557] – Set a Referrer-Policy on login/register pages
  • [MBS-13563] – Autocomplete2 should italicize primary aliases and sort names

Task

  • [MBS-12359] – Refactor _columns implementation in data model
  • [MBS-12371] – Allow using musicbrainz_ro user in PROD_STANDBY database
  • [MBS-13348] – Sync edit_data_idx_link_type with EditSearch::Predicate::RelationshipType
  • [MBS-13358] – Upgrade the required version of Perl to 5.38
  • [MBS-13361] – Upgrade the required version of PostgreSQL to 16
  • [MBS-13403] – Drop unused priority column from link_type

2 thoughts on “MusicBrainz schema change release, 2024-05-13 (with upgrade instructions)”

  1. The instructions here are correct, since they are meant for people coming from schema 28 and ending at schema 29. People starting from scratch should indeed be in schema 29 as per your ticket, we’ll make sure to update that info.

Leave a Reply

Your email address will not be published. Required fields are marked *