Schema change release, 2017-05-15 (including upgrade instructions)

We’re happy to announce the release of our May 2017 schema change today! Thanks to all who were patient during today’s downtime as we released everything to our production servers.

This is a fairly minor release as far as schema changes go, but please do report any issues that you come across.

Currently, the only visible change for editors is the ability to add multiple lyrics languages to works. We’ve also modified the schema to support dynamic attributes for entities other than works, but the UI for that won’t be complete for another release or two.

Now, on to the instructions.

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 rest of the instructions here assume an in-place upgrade.

  1. Make sure DB_SCHEMA_SEQUENCE is set to 23 in lib/DBDefs.pm.
  2. If you’re using the live data feed (your REPLICATION_TYPE is set to RT_SLAVE), 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 #24, but the database is currently at #23.”
  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. Switch to the new code with git fetch origin followed by git checkout v-2017-05-15-schema-change.
  6. Run cpanm --installdeps --notest . (note the dot at the end) to ensure your perl-based dependencies are up to date.
  7. Run ./upgrade.sh (it may take a while to vacuum at the end).
  8. Set DB_SCHEMA_SEQUENCE to 24 in lib/DBDefs.pm as instructed by the output of ./upgrade.sh.
  9. Turn cron jobs back on, if applicable.
  10. Restart the MusicBrainz web server, if applicable. It’s also recommended you restart redis. If you’re accessing your MusicBrainz server in a web browser, run npm install followed by ./script/compile_resources.sh.

For those curious, here’s the list of resolved tickets (excluding MBS-8393):

Bug

New Feature

  • [MBS-9271] – Prevent usernames from being reused

Task

  • [MBS-9273] – Fix the a_ins_edit_note function in older setups to not populate edit_note_recipient for own notes
  • [MBS-9274] – Fix the edit_note_idx_post_time_edit index in older setups to handle NULL post_time

Improvement

  • [MBS-5452] – Support multiple lyric language values for works

14 thoughts on “Schema change release, 2017-05-15 (including upgrade instructions)

  1. InvisibleMan78

    Thanks for the above instructions.
    Are they valid for your VM too?

  2. mwiencek Post author

    @InvisibleMan78 AFAIK, there’s nothing special about the VM that would make these steps not work, assuming you know how to take down the web server there, turn off cron, etc. The commands listed should apply to any MBS install, VM or not. But, I also haven’t tested any of this inside the VM.

  3. rembo10

    I had to run `cpanm –installdeps –notest .` before `./upgrade.sh`
    and
    `npm install` before running `./script/compile_resources.sh` in order to get all the dependencies

  4. mwiencek Post author

    @rembo10, thanks, I’ve updated the steps in the blog post too in case it helps others. I’m curious what modules you had missing that upgrade.sh needed.

  5. theguardian

    I’m getting errors when running plackup and the web server fails to start.

    raven@1.2.0 alert: no DSN provided, error reporting disabled
    raven@1.2.0 alert: uncaughtException:

    Looks like this bug was fixed with raven@2.0.0, but upgrading to that version causes other problems. (ref: https://github.com/getsentry/raven-node/issues/301)

  6. InvisibleMan78

    How can we apply the latest fix from @mwiencek?
    Could please someone instruct us with the necessary commands?

  7. InvisibleMan78

    Where should we report errors like
    “undef error – malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before “(end of string)”) at lib/MusicBrainz/Server/Renderer.pm line 42. ”
    calling the local webserver in a browser?

  8. mwiencek Post author

    @InvisibleMan78 At http://tickets.musicbrainz.org please!

    I’ve noticed the same error in production, but only 4 times (so far) out of thousands and thousands of requests, so I’m not sure how to reproduce it yet. If you can consistently reproduce it, that would be great information to provide in the ticket.

  9. boehmi

    Were anybody actually able to upgrade the VM? After “cpanm –installdeps –notest .” I needed to install libjson-perl and libmoose-perl, but then I I get these errors when running “./upgrade.sh”

    vagrant@musicbrainz:~/musicbrainz-server$ ./upgrade.sh
    ~/musicbrainz-server/admin ~/musicbrainz-server
    ~/musicbrainz-server
    Use of uninitialized value $ENV{“DB_ENV_POSTGRES_USER”} in string at lib/DBDefs.pm line 51.
    Use of uninitialized value $ENV{“DB_ENV_POSTGRES_PASSWORD”} in string at lib/DBDefs.pm line 51.
    Use of uninitialized value $ENV{“DB_PORT_5432_TCP_ADDR”} in string at lib/DBDefs.pm line 51.
    Use of uninitialized value $ENV{“DB_PORT_5432_TCP_PORT”} in string at lib/DBDefs.pm line 51.
    Use of uninitialized value $ENV{“DB_ENV_POSTGRES_USER”} in string at lib/DBDefs.pm line 51.
    Use of uninitialized value $ENV{“DB_ENV_POSTGRES_PASSWORD”} in string at lib/DBDefs.pm line 51.
    Use of uninitialized value $ENV{“DB_PORT_5432_TCP_ADDR”} in string at lib/DBDefs.pm line 51.
    Use of uninitialized value $ENV{“DB_PORT_5432_TCP_PORT”} in string at lib/DBDefs.pm line 51.
    Use of uninitialized value $ENV{“DB_ENV_POSTGRES_USER”} in string at lib/DBDefs.pm line 51.
    Use of uninitialized value $ENV{“DB_ENV_POSTGRES_PASSWORD”} in string at lib/DBDefs.pm line 51.
    Use of uninitialized value $ENV{“DB_PORT_5432_TCP_ADDR”} in string at lib/DBDefs.pm line 51.
    Use of uninitialized value $ENV{“DB_PORT_5432_TCP_PORT”} in string at lib/DBDefs.pm line 51.
    Attribute (port) does not pass the type constraint because: Validation failed for ‘Int’ with value “” at constructor MusicBrainz::Server::Database::new (defined at lib/MusicBrainz/Server/Database.pm line 53) line 52.
    MusicBrainz::Server::Database::new(‘MusicBrainz::Server::Database’, ‘HASH(0xe1b300)’) called at lib/MusicBrainz/Server/DatabaseConnectionFactory.pm line 19
    MusicBrainz::Server::DatabaseConnectionFactory::register_databases(‘MusicBrainz::Server::DatabaseConnectionFactory’, ‘READWRITE’, ‘HASH(0x1df8dc8)’, ‘TEST’, ‘HASH(0xe1af70)’, ‘READONLY’, ‘HASH(0xe1b120)’, ‘SYSTEM’, ‘HASH(0xe1b300)’) called at lib/DBDefs.pm line 51
    require DBDefs.pm called at -e line 1
    main::BEGIN() called at lib/DBDefs.pm line 0
    eval {…} called at lib/DBDefs.pm line 0
    Compilation failed in require at -e line 1.
    BEGIN failed–compilation aborted at -e line 1.

  10. SB

    I had the same issue as boehmi updating the VM. Any tips or suggestions welcome.

  11. Alvaro

    Same here… Unable to update schema on VM with dockers.
    Same error as boehmi

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s