We are connecting to MSSQL server DB via GitLab pipeline. I checked DATABASECHANGELOGLOCK table & it shows locked=0
But when we try to apply the changes to the DB, it’s giving error as
liquibase.exception.LockException: Could not acquire change log lock. Currently locked by runner-mftxrtxr-project-28473992-concurrent-0 (172.17.0.3) since 9/15/22, 2:09 AM
Unable to find the runner ID runner-mftxrtxr-project-28473992-concurrent-0 in GitLab logs as well.
We executed below SQL statement but still getting above error
UPDATE DATABASECHANGELOGLOCK SET LOCKED=0, LOCKGRANTED=null, LOCKEDBY=null where ID=1;
Please help and let us know if we are missing anything
By running the following command:
select * from DATABASECHANGELOGLOCK;
You should be able to check the
lockedby column to see who locked the table. Generally, the lock will be from the local machine.
Assuming this is the case (and no other machine has a lock on the database), this should resolve the issue:
Execute the following SQL query against the database:
set locked=0, lockgranted=null, lockedby=null
Please let us know if you encounter any issues.
Quick question: how is GitLab pipeline configured? Is it by any chance (unintended) running two Liquibase deploys in the same time, over the same target DB ?
Also, could you try unlocking the databasechangeloglock table with the more “official” way, via release-locks command (and then re-try the deploy)? release-locks | Liquibase Docs
Thanks for your response, No its executing only one Liquibase instance on target DB.
Yes, now I’ve added extra job to release-lock (irrespective of locks) before execution/update.
@spbendekar, did that addressed the issue or it still persists?
(Normally this should not be required, any Liquibase deploy, at the end, automatically releases that lock(for clean setup on next deploy)).