Liquibase lock - reasons?

Liquibase is a database migration tool that helps manage changes to a database schema. The liquibase lock is a mechanism that prevents multiple users or processes from modifying the database schema simultaneously, which could lead to conflicts or data corruption. The lock is acquired when migration is started and released when it is completed.
There are several reasons why a Liquibase lock might be acquired:
  1. Concurrent execution: This occurs when multiple users or processes try to execute a migration at the same time. To prevent conflicts, Liquibase acquires a lock to ensure that only one migration can run at a time.
  2. Unexpected termination: If a migration is terminated unexpectedly (e.g., due to a power outage or system crash), the lock may not be released. In this case, the lock will need to be manually released before a new migration can be run.
  3. Misconfigured or malfunctioning lock table: If it is misconfigured or not functioning correctly, it may prevent new migrations from being executed.
  4. Deadlock: if two or more processes are waiting for each other to release the lock and none can proceed, it results in a deadlock, and the lock will need to be manually released to proceed.
If the lock is acquired, the migration process will be blocked until the lock is released. If a lock is acquired due to a deadlock, an administrator must intervene to resolve the issue and release the lock.