5

I have spring boot application which have defined database migrations using liquibase. When I start application script wait 500s and check http status of application. When it returns error code script kills application process and try to start application again. Application is killed during starting sometimes and liquibase don't remove records from databasechangeloglock. When application runs next time it wait for release lock, but it doesn't happen and application is killed again and again.

In logs last lines from each application are:

liquibase    : Waiting for changelog lock....
liquibase    : Waiting for changelog lock....

Do you have any ideas how to solve this problem inside script?

krynio
  • 2,442
  • 26
  • 30
  • See https://stackoverflow.com/q/61387510/1704634 , you can use the liquibase-sessionlock extension which improves the standard lock service. – blagerweij Jan 11 '21 at 23:27
  • Does this answer your question? [Is there a configuration for removing LiquiBase DATABASE CHANGELOGLOCK automatically after a certain time or on app restart?](https://stackoverflow.com/questions/63254808/is-there-a-configuration-for-removing-liquibase-database-changeloglock-automatic) – blagerweij Jan 13 '21 at 10:07

1 Answers1

3

Liquibase changes are controlled by 2 tables, which will be in the schema that is being altered:

1) databasechangeloglock_table

2) databasechangelog_table

Your changes are not running because the databasechangeloglock table has the LOCKED column set. You can manually unset this before you start the server/application again.

BE VERY CAREFUL WHICH CHANGESETS HAVE RUN BEFORE YOU DO THIS

If you are sure a change set has not run you can delete the relavent row from both change log tables.

Essex Boy
  • 7,565
  • 2
  • 21
  • 24