liquibase.exception.LockException: Could not acquire change log lock

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

2 Likes

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:

update DATABASECHANGELOGLOCK
set locked=0, lockgranted=null, lockedby=null
where id=1

Please let us know if you encounter any issues.

1 Like

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,
Eduard

1 Like

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.

2 Likes

@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)).

Thanks,
Eduard

1 Like