Search code examples
timeoutlockingliquibaselock-timeout

Is there a liquibase lock timeout?


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?


Solution

  • 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.