You can see in the issue here: (liquibase-lock-reasons) at situation where the client Liquibase locks when a Liquibase operation has been interrupted, leaving liquibase in a locked state.
I'm wondering if there is a way to configure Liquibase to automatically detect this situation from the date and time in the LOCKGRANTED
column. I think if you've held onto the lock for an hour - you should call that an expired lock.
My question is: Is there a liquibase lock timeout?
Liquibase uses the DATABASECHANGELOGLOCK table to ensure only one instance of Liquibase runs at a time. When you make a database update, Liquibase reads from the DATABASECHANGELOG table to determine which changesets need to run.
Liquibase uses the DATABASECHANGELOG table to track which changesets have been run. If the table does not exist in the database, Liquibase creates one automatically.
Liquibase allows you to specify the database change you want using SQL or several different database-agnostic formats, including XML, YAML, and JSON. Developers can abstract the database code to make it extremely easy to push out changes to different database types.
There is no lock timeout. Liquibase has no idea of how long to expect changeSets to take, and if some are doing DML on large tables they can take hours to run successfully.
liquibase: Waiting for changelog lock.... Containers that use Liquibase, for managing and applying database schema changes, execute a task during startup that determines whether schema changes need to be applied or not.
Liquibase uses the DATABASECHANGELOGLOCK table to ensure only one instance of Liquibase runs at a time. When you make a database update, Liquibase reads from the DATABASECHANGELOG table to determine which changeset s need to run.
One of the most popular InnoDB’s errors is InnoDB lock wait timeout exceeded, for example: SQLSTATE [HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction The above simply means the transaction has reached the innodb_lock_wait_timeout while waiting to obtain an exclusive lock which defaults to 50 seconds.
There is no lock timeout. Liquibase has no idea of how long to expect changeSets to take, and if some are doing DML on large tables they can take hours to run successfully.
There is a releaseLocks command you can use to clear the locks manually, or you could subclass liquibase.lockservice.StandardLockService to add additional logic to override the lock after after a set period of time.
If you have only one machine that would be updating the database, you can consider https://github.com/liquibase/liquibase-nochangeloglock as well, which completely disables the lock support.
I could see it as being a useful feature to have configurable, so I did add https://liquibase.jira.com/browse/CORE-2375 to track the feature.
Actually,looking at the code of StandardLockService, it is configurable using the system property "liquibase.changeLogLockWaitTimeInMinutes"...
public class StandardLockService implements LockService {
...
private long changeLogLockWaitTime = 300000L;
....
public StandardLockService() {
try {
this.changeLogLockWaitTime = 60000L * Long.parseLong(System.getProperty("liquibase.changeLogLockWaitTimeInMinutes"));
LogFactory.getLogger().info("lockWaitTime change to: " + this.changeLogLockWaitTime);
} catch (NumberFormatException var2) {
;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With