当应用程序崩溃时,Spring Liquibase恢复 [英] Spring liquibase recover when application is crashed

查看:108
本文介绍了当应用程序崩溃时,Spring Liquibase恢复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Spring Boot应用程序,该应用程序使用liquibase定义了数据库迁移. 当我启动应用程序脚本时,请等待500秒钟,然后检查应用程序的http状态.当它返回错误代码时,脚本将终止应用程序进程,并尝试再次启动应用程序. 有时在启动过程中应用程序被杀死,并且liquibase不会从databasechangeloglock中删除记录.下次运行应用程序时,它将等待释放锁定,但不会发生,并且一次又一次杀死应用程序.

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?

推荐答案

Liquibase更改由2个表控制,这些表将处于要更改的架构中:

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

1)数据库更改loglock_table

2)数据库更改日志表

您的更改未在运行,因为databasechangeloglock表已设置LOCKED列.您可以在重新启动服务器/应用程序之前手动取消设置.

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.

在执行此操作之前,请务必小心

如果确定更改集尚未运行,则可以从两个更改日志表中删除相关行.

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

这篇关于当应用程序崩溃时,Spring Liquibase恢复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆