Lock acquired without pending changes

Hi! Trying to set up an application with Liquibase to support a senario where a master DB node is failing but a read-only slave node is still available. I was expecting the application (Spring Boot) to be able to start even when it has a read-only database connection. But it seems the lock is acquired whether or not any changes needs to be applied preventing the application from starting up. The lock is acquired even before posts in the DATABASECHANGELOG table are fetched and compared to the change sets.

Is there any way to make Liquibase only acquire the lock if it detects there is some new change set to apply?

@erikb This may not be exactly the solution you’re looking for, but one way to fix this is to just configure your app to not run Liquibase at all on start-up.

Depending on the version of Spring you’re using you can set a property in your application.properties file (or application.yaml if that’s what you’re using instead) to disable Liquibase on startup.

For the latest version of Spring you would set this:

spring.liquibase.enabled=false

For older versions of Spring you may need to use this instead:

liquibase.enabled=false

For the application that I work with we never run Liquibase on app start-up, we always manage running Liquibase separately.