changelog-lock-wait-time-in-minutes
The changelog-lock-wait-time-in-minutes global parameter is an integer value that sets the amount of time Liquibase waits for a locked database to become available. The default value is 5.
DATABASECHANGELOGLOCK table
The DATABASECHANGELOGLOCK table only allows a single instance of Liquibase to run at a time. This prevents conflicts between multiple developers working at the same time or multiple servers in a cluster that auto-run Liquibase on startup.
DATABASECHANGELOGLOCK has a column named LOCKED
that is set to 1
while Liquibase is running and 0
otherwise. If you try to run Liquibase while the lock record is active, the following message is printed to STDOUT
:
Waiting for changelog lock....
This message repeats until LOCKED
is set to 0
. If the amount of time specified in changelog-lock-wait-time-in-minutes
passes and the lock is not released, Liquibase stops running.
Uses
Liquibase doesn’t automatically time out if a database update takes a long time to finish. If you need to run multiple database updates at once, and each of them takes a long time to complete, you can raise the value of changelog-lock-wait-time-in-minutes
. This way, you don’t have to re-run commands that timed out.
If you need to limit system resources by halting processes in a "waiting" state, you can lower the value of changelog-lock-wait-time-in-minutes
.
Syntax
You can set this parameter in the following ways:
Option | Syntax |
Liquibase properties file (defaults file) | liquibase.changelogLockWaitTimeInMinutes: <int> |
Global flow file argument (example) | stages: Default: actions: - type: liquibase command: update globalArgs: { changelog-lock-wait-time-in-minutes: "<int>" } |
Global CLI parameter | liquibase --changelog-lock-wait-time-in-minutes=<int> update --changelog-file=example-changelog.xml |
JVM system property (JAVA_OPTS environment variable) | Unix: JAVA_OPTS=-Dliquibase.changelogLockWaitTimeInMinutes=<int> Windows: JAVA_OPTS=-D"liquibase.changelogLockWaitTimeInMinutes"=<int> |
Liquibase environment variables | LIQUIBASE_COMMAND_CHANGELOG_FILE=<true|false> |