0

I have code to run liquibase during server startup.

I am running against ORACLE db.

I have an issue where the first instance is starting fine. The other is blocked on SELECT FOR UPDATE.

I've found this code in SelectFromDatabaseChangeLogLockGenerator:

if (database instanceof OracleDatabase) {
    sql += " FOR UPDATE";
}

For some reason (why?) the first server is holding a lock on the talbe hence the other server instance is stuck on startup.

  1. why does listLocks api in LockService do a FOR UPDATE select?
  2. any ideas how to bypass this?

Note: I need to check for locks upon startup so I call list locks programmatically.

YaOg
  • 1,748
  • 5
  • 24
  • 43
  • You can have just one instance running migration in given schema. 2nd one will get stucked until 1st one finishes. Sometimes if liquibase exists unexpectedly, lock can stay kept, see https://stackoverflow.com/questions/15528795/liquibase-lock-reasons – igr Sep 15 '19 at 12:59
  • @igr this is my case. lock was not released. however, I don't want to simply delete from lock table or drop it so I want to use LockService to check if such lock exists (based on the lock column). But LockService doesn't provide a "regular" select for me to use. – YaOg Sep 15 '19 at 13:55
  • A possible solution for me would be: https://liquibase.jira.com/projects/CORE/issues/CORE-2536 – YaOg Sep 16 '19 at 05:46
  • I've opened https://liquibase.jira.com/browse/CORE-3476 to track this. – YaOg Sep 16 '19 at 05:54
  • I guess something happened that caused lock stays in active state. If there is no active migrations it is safe to update or delete the line – igr Sep 16 '19 at 14:57

0 Answers0