Confluence Upgrade Failed with liquibase.exception.LockException: Could not acquire change log lock Error

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Problem

Upgrading to Confluence 6.14 and above fails with the the following error appears in the atlassian-confluence.log

2019-04-01 12:45:19,509 ERROR \[Caesium-1-2] \[migration.agent.queue.QueueBroker] error An error occurred when getting the next batch for consumer type: CONFLUENCE_IMPORT. Message: javax.persistence.PersistenceException: Failed to update database schema
com.atlassian.util.concurrent.LazyReference$InitializationException: javax.persistence.PersistenceException: Failed to update database schema
	at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:149\)
	at com.atlassian.util.concurrent.LazyReference.get(LazyReference.java:112\)
	at com.atlassian.migration.agent.store.jpa.impl.DefaultSessionFactorySupplier.get(DefaultSessionFactorySupplier.java:57\)
	at com.atlassian.migration.agent.store.jpa.impl.DefaultSessionFactorySupplier.get(DefaultSessionFactorySupplier.java:36\)
	at com.atlassian.migration.agent.store.jpa.impl.DefaultPluginTransactionTemplate.on(DefaultPluginTransactionTemplate.java:33\)
	at com.atlassian.migration.agent.store.tx.PluginTransactionTemplate.write(PluginTransactionTemplate.java:26\)
	at com.atlassian.migration.agent.queue.QueueBroker.getNextBatch(QueueBroker.java:119\)
...
	at java.util.ArrayList.forEach(ArrayList.java:1257\)
	at com.atlassian.migration.agent.queue.QueueBroker.runJob(QueueBroker.java:100\)
	at com.atlassian.confluence.impl.schedule.caesium.JobRunnerWrapper.doRunJob(JobRunnerWrapper.java:117\)
...
Caused by: javax.persistence.PersistenceException: Failed to update database schema
	at com.atlassian.migration.agent.store.jpa.impl.LiquibaseSchemaUpgrader.upgrade(LiquibaseSchemaUpgrader.java:35\)
	at com.atlassian.migration.agent.store.jpa.impl.DefaultSessionFactorySupplier.buildSessionFactory(DefaultSessionFactorySupplier.java:62\)
...
	at com.atlassian.migration.agent.store.jpa.impl.DefaultSessionFactorySupplier.get(DefaultSessionFactorySupplier.java:57\)
	at com.atlassian.migration.agent.store.jpa.impl.DefaultSessionFactorySupplier.get(DefaultSessionFactorySupplier.java:36\)
	at com.atlassian.migration.agent.store.jpa.impl.DefaultPluginTransactionTemplate.on(DefaultPluginTransactionTemplate.java:33\)
	at com.atlassian.migration.agent.store.tx.PluginTransactionTemplate.read(PluginTransactionTemplate.java:18\)
	at com.atlassian.migration.agent.service.impl.DefaultStatisticsService.calculateServerStats(DefaultStatisticsService.java:132\)
	at com.atlassian.migration.agent.service.impl.SingleJobExecutor.lambda$execute$0(SingleJobExecutor.java:28\)
...
Caused by: liquibase.exception.LockException: Could not acquire change log lock.  Currently locked by <DatabaseServer> \(<DatabaseServerIP>\) since 04.02.19 20:03
	at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:230\)
	at liquibase.Liquibase.update(Liquibase.java:184\)
	at liquibase.Liquibase.update(Liquibase.java:179\)
	at com.atlassian.migration.agent.store.jpa.impl.LiquibaseSchemaUpgrader.upgrade(LiquibaseSchemaUpgrader.java:30\)

Cause

This issue occurred as the MIG_DB_CHANGELOG_LOCK table has not been updated with the release lock information and this is likely to be caused by force termination of Confluence while it was trying to migrate the Database schema after an upgrade. 

(info) The MIG_DB_CHANGELOG_LOCK table is related to the Cloud Migration Assistant for Confluence plugin which is bundled by default since Confluence 6.14.

Workaround

You may choose one of the workarounds below to resolve this issue:

  • To release the lock manually by executing the SQL query below in the Confluence Database. 

    Click here to expand for PostgreSQL
    PostgreSQL
    UPDATE MIG_DB_CHANGELOG_LOCK SET LOCKED=false, LOCKGRANTED=null, LOCKEDBY=null where ID=1;
    Click here to expand for MySQL, SQL Server and Oracle
    MySQL, SQL Server and Oracle
    UPDATE MIG_DB_CHANGELOG_LOCK SET LOCKED=0, LOCKGRANTED=null, LOCKEDBY=null where ID=1;
  • Besides that, you may also disable the Cloud Migration Assistant for Confluence in the Confluence instance to workaround this.


Description
ProductConfluence

Last modified on Jul 23, 2019

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.