Metabase Failed Upgrade


#1

I attempted to upgrade from version 0.23.1 to 0.28.5 thinking that minor version updates would be innocuous and as simple as the upgrade instructions indicated. After following those instructions, however, I am unable to use my Metabase, and am concerned that the hundreds of questions my organization has created may be lost.

I’m looking for pretty broad advice at this point, and any help would be greatly appreciated in either:

  1. Fixing the issue with my current metabase
  2. Finding a strategy to import the queries from my old database to use a new metabase instance

I am:

  • Deploying using AWS
  • Have a separately hosted MySQL database for Metabase data
  • Not super familiar with Docker so apologies in advance

When I pull the logs from my instance after attempting to deploy 0.28.5 I see the following:

04-10 22:35:30 e[1mINFO metabase.dbe[0m :: e[36mVerifying mysql Database Connection ...e[0m
04-10 22:35:30 e[1mINFO metabase.dbe[0m :: Verify Database Connection ...  ✅
04-10 22:35:30 e[1mINFO metabase.dbe[0m :: Running Database Migrations...
04-10 22:35:30 e[1mINFO metabase.dbe[0m :: Setting up Liquibase...
04-10 22:35:30 e[1mINFO metabase.dbe[0m :: Liquibase is ready.
04-10 22:35:30 e[1mINFO metabase.dbe[0m :: Checking if Database has unrun migrations...
04-10 22:36:23 e[1mWARN liquibasee[0m :: modifyDataType will lose primary key/autoincrement/not null settings for mysql.  Use <sql> and re-specify all configuration if this is the case
04-10 22:36:23 e[1mWARN liquibasee[0m :: modifyDataType will lose primary key/autoincrement/not null settings for mysql.  Use <sql> and re-specify all configuration if this is the case
04-10 22:36:23 e[1mINFO metabase.dbe[0m :: Database has unrun migrations. Waiting for migration lock to be cleared...
04-10 22:36:25 e[1mWARN metabase.utile[0m :: e[31mauto-retry metabase.db$wait_for_migration_lock_to_be_cleared$fn__19114@79200f8: Database has migration lock; cannot run migrations. You can force-release these locks by running `java -jar metabase.jar migrate release-locks`.e[0m
04-10 22:36:27 e[1mWARN metabase.utile[0m :: e[31mauto-retry metabase.db$wait_for_migration_lock_to_be_cleared$fn__19114@79200f8: Database has migration lock; cannot run migrations. You can force-release these locks by running `java -jar metabase.jar migrate release-locks`.e[0m
04-10 22:36:29 e[1mWARN metabase.utile[0m :: e[31mauto-retry metabase.db$wait_for_migration_lock_to_be_cleared$fn__19114@79200f8: Database has migration lock; cannot run migrations. You can force-release these locks by running `java -jar metabase.jar migrate release-locks`.e[0m
04-10 22:36:31 e[1mWARN metabase.utile[0m :: e[31mauto-retry metabase.db$wait_for_migration_lock_to_be_cleared$fn__19114@79200f8: Database has migration lock; cannot run migrations. You can force-release these locks by running `java -jar metabase.jar migrate release-locks`.e[0m
04-10 22:36:33 e[1mWARN metabase.utile[0m :: e[31mauto-retry metabase.db$wait_for_migration_lock_to_be_cleared$fn__19114@79200f8: Database has migration lock; cannot run migrations. You can force-release these locks by running `java -jar metabase.jar migrate release-locks`.e[0m
java.lang.Exception: Database has migration lock; cannot run migrations. You can force-release these locks by running `java -jar metabase.jar migrate release-locks`.
	at metabase.db$wait_for_migration_lock_to_be_cleared$fn__19114.invoke(db.clj:153)

Any ideas on how to solve this?


#2

It happen from time to time when people upgrade - you will see it if you search for “migrate release-locks” here on Discourse. I guess a recent version of the “canonical answer” is the one given by salsakran here:

But while at it a question of course would be how do you fare regarding :blue_book: backups? If you didn’t already have a good backup procedure in place maybe this would be a good time to think about that. Because then you can experiment freely on a copy of you database.


#3

Thanks for your reply. Can you point me in the direction of where that command is supposed to be run? When I try on EC2 I’m met with the unhelpful

Error: Unable to access jarfile metabase.jar


#4

Sorry I’m not really familiar with how it’s actually deployed on EC2. But you mention docker which we use for our Metabase production and test instances. So assuming that’s where you have it running I guess you have two options:

Do whatever you feel most comfortable doing. (I can try plunking around a bit with the the docker interactive session thing if need be)


#5

Well it wasn’t elegant, but I ended up resolving this by creating a brand new environment with the 0.23.1 version of the application, and manually migrating the data from my snapshot into the old structure, without the newly migrated fields from 0.28.5.

I’d love to upgrade in the future, but I guess we’ll just hold off on doing that until the upgrade process is safer. No idea how we’ll know that, given that the instructions appeared to indicate that it should have been no big deal to upgrade, but we’ll worry about that if / when we have to.

Thanks for trying to point me in the direction of fixing the logged error. Wish I had a better grip on what that entailed because I’m sure that would have been less laborious.


#6

Sorry to hear that – but good that you are at least back up and running with more or less .

As 0.23.1 is now fairly old I think if I were in your shoes I would try to narrow down in what half of the versions the migration gets stuck - and experiment with it with a stand-alone .jar + Metabase application database. The old versions seem to be available if you substitute the version numbers at the official download link.