changelog-lock-poll-rate

The changelog-lock-poll-rate global parameter is an integer that sets the number of seconds Liquibase waits to check if a Changelog lock has been released. The default value is 10.

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. The number of seconds Liquibase waits before checking the lock status at each interval is determined by the value of changelog-lock-poll-rate.

Uses

If you need to run multiple database updates at once and want to minimize the amount of unused time between deployments, you can lower the value of changelog-lock-poll-rate. This way, Liquibase will check more frequently whether the changelog lock has been released.

If you need to limit system resources, or if you know that the changelog lock will be active for a long time, you can raise the value of changelog-lock-poll-rate.

Syntax

You can set this parameter in the following ways:

Option Syntax
Liquibase properties file (defaults file)
liquibase.changelogLockPollRate: <int>
Global flow file argument (example)
stages:
  Default:
    actions:
      - type: liquibase
        command: update
        globalArgs: { changelog-lock-poll-rate: "<int>" }
Global CLI parameter
liquibase
 --changelog-lock-poll-rate=<int> update
 --changelog-file=example-changelog.xml

JVM system property (JAVA_OPTS Environment Variable)

JAVA_OPTS=-Dliquibase.changelogLockPollRate=<int>
Liquibase Environment Variables
LIQUIBASE_CHANGELOG_LOCK_POLL_RATE=<int>

For more information, see Working with Command Parameters.

Related links