Spring liquibase recover when application is crash

2019-07-13 16:10发布

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?

1条回答
forever°为你锁心
2楼-- · 2019-07-13 16:35

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.

查看更多
登录 后发表回答