Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring liquibase recover when application is crashed

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?

like image 550
krynio Avatar asked Oct 17 '22 18:10

krynio


1 Answers

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.

like image 190
Essex Boy Avatar answered Oct 21 '22 04:10

Essex Boy