无法获得 table 锁 - 另一个 Flyway 实例可能是 运行
Unable to obtain table lock - another Flyway instance may be running
我正在使用 Spring Boot 和 Flyway (6.5.5) 的集成来对 CockroachDB 集群进行 运行 更新。当多个服务实例同时启动时,它们都试图锁定 flyway_schema_history
table 以验证迁移。但是,出现以下异常:
2020-09-09 00:00:00.013 ERROR 1 --- [ main] o.s.boot.SpringApplication :
Application run failed org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]:
Invocation of init method failed; nested exception is org.flywaydb.core.api.FlywayException:
Unable to obtain table lock - another Flyway instance may be running
我找不到任何配置 属性 来调整它。也许有人遇到过同样的问题并以某种方式解决了?
解决方法:重启服务。
调试问题后,它出现在非常奇怪的 Flyway 行为中:
org.flywaydb.core.internal.database.cockroachdb.CockroachDBTable
CockroachDB-specific table.
Note that CockroachDB doesn't support table locks. We therefore use a row in the schema history as a lock indicator;
if another process ahs inserted such a row we wait (potentially indefinitely) for it to be removed before
carrying out a migration.
*/
因此,在我的情况下,在应用迁移期间,服务被重新启动并且此伪锁定记录永远存在。
解决方法是手动删除“锁”:
installed_rank | version | description | type | script | checksum | installed_by | installed_on | execution_time | success
-----------------+----------------------------------+------------------------------------------+------+--------------------------------------------------+-------------+--------------------+----------------------------------+----------------+----------
-100 | d9ab17626a4d66a4d8a89fe9bdca98e9 | flyway-lock | | | 0 | | 2020-09-14 11:25:02.874838+00:00 | 0 | true
希望,它会对某人有所帮助。
我正在使用 Spring Boot 和 Flyway (6.5.5) 的集成来对 CockroachDB 集群进行 运行 更新。当多个服务实例同时启动时,它们都试图锁定 flyway_schema_history
table 以验证迁移。但是,出现以下异常:
2020-09-09 00:00:00.013 ERROR 1 --- [ main] o.s.boot.SpringApplication :
Application run failed org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]:
Invocation of init method failed; nested exception is org.flywaydb.core.api.FlywayException:
Unable to obtain table lock - another Flyway instance may be running
我找不到任何配置 属性 来调整它。也许有人遇到过同样的问题并以某种方式解决了?
解决方法:重启服务。
调试问题后,它出现在非常奇怪的 Flyway 行为中: org.flywaydb.core.internal.database.cockroachdb.CockroachDBTable
CockroachDB-specific table.
Note that CockroachDB doesn't support table locks. We therefore use a row in the schema history as a lock indicator;
if another process ahs inserted such a row we wait (potentially indefinitely) for it to be removed before
carrying out a migration.
*/
因此,在我的情况下,在应用迁移期间,服务被重新启动并且此伪锁定记录永远存在。
解决方法是手动删除“锁”:
installed_rank | version | description | type | script | checksum | installed_by | installed_on | execution_time | success
-----------------+----------------------------------+------------------------------------------+------+--------------------------------------------------+-------------+--------------------+----------------------------------+----------------+----------
-100 | d9ab17626a4d66a4d8a89fe9bdca98e9 | flyway-lock | | | 0 | | 2020-09-14 11:25:02.874838+00:00 | 0 | true
希望,它会对某人有所帮助。