Liquibase lock - reasons?

ghz 8months ago ⋅ 83 views

I get this when running a lot of liquibase-scripts against a Oracle-server. SomeComputer is me.

Waiting for changelog lock.... Waiting for changelog lock.... Waiting for changelog lock.... Waiting for changelog lock.... Waiting for changelog lock.... Waiting for changelog lock.... Waiting for changelog lock.... Liquibase Update Failed: Could not acquire change log lock. Currently locked by SomeComputer (192.168.15.X) since 2013-03-20 13:39 SEVERE 2013-03-20 16:59:liquibase: Could not acquire change log lock. Currently locked by SomeComputer (192.168.15.X) since 2013-03-20 13:39 liquibase.exception.LockException: Could not acquire change log lock. Currently locked by SomeComputer (192.168.15.X) since 2013-03-20 13:39 at liquibase.lockservice.LockService.waitForLock(LockService.java:81) at liquibase.Liquibase.tag(Liquibase.java:507) at liquibase.integration.commandline.Main.doMigration(Main.java:643) at liquibase.integration.commandline.Main.main(Main.java:116) Could it be that the number of simultaneous sessions/transactions are reached? Anyone has any ideas?

Answers

The error message you provided indicates that Liquibase is unable to acquire a lock on the changelog table in the database. This lock is typically used to prevent multiple instances of Liquibase from making changes to the database simultaneously, which could lead to conflicts or data corruption.

There are a few potential reasons why Liquibase might be unable to acquire the lock:

  1. Existing lock: Another instance of Liquibase or a different tool might already have a lock on the changelog table. This could happen if a previous run of Liquibase was interrupted or if another process is actively using the database.

  2. Long-running operation: If a Liquibase operation is taking an unusually long time to complete, it could prevent other instances from acquiring the lock. This might happen if a complex migration is running or if there are resource constraints on the database server.

  3. Network or connectivity issues: If there are network issues between the machine running Liquibase and the database server, it could cause problems with acquiring the lock.

To troubleshoot the issue, you can try the following steps:

  • Check if there are any long-running operations or locks on the database that might be preventing Liquibase from acquiring the lock.
  • Verify that there are no network or connectivity issues between the machine running Liquibase and the database server.
  • If possible, try restarting the database server to release any existing locks on the changelog table.
  • Ensure that Liquibase is configured correctly and that it's using the correct credentials to connect to the database.
  • If the problem persists, you may need to consult the Liquibase documentation or contact their support for further assistance.