Confluence Setup fails when reading a hi value in hibernate_unique_key table
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. 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
Summary
Confluence Setup fails due to being unable to read a hi value in HIBERNATE_UNIQUE_KEY table
Environment
Confluence 7.19.X and Confluence 8.X running with MySQL as repository
Diagnosis
In the atlassian-confluence.log
, the following message will be observed few times:
2024-03-08 15:21:07,934 ERROR [http-nio-8090-exec-5] [atlassian.confluence.servlet.ConfluenceServletDispatcher] sendError Could not execute action
-- url: /setup/setupdbtype.action | traceId: 0081ba48f3614c82 | userName: anonymous | referer: https://CONFLUENCE_URL/setup/setupdbtype.action?database=mysql&atl_token=f3beddf9cdd6c869dff7a27928c364c67ba8131d
org.springframework.orm.hibernate5.HibernateSystemException: could not read a hi value - you need to populate the table: hibernate_unique_key; nested exception is org.hibernate.id.IdentifierGenerationException: could not read a hi value - you need to populate the table: hibernate_unique_key
at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:267)
at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:370)
at org.springframework.orm.hibernate5.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:334)
at org.springframework.orm.hibernate5.HibernateTemplate.save(HibernateTemplate.java:613)
at com.atlassian.confluence.setup.bandana.persistence.dao.hibernate.HibernateConfluenceBandanaRecordDao.saveOrUpdate(HibernateConfluenceBandanaRecordDao.java:39)
at com.atlassian.confluence.setup.bandana.ConfluenceDaoBandanaPersister.store(ConfluenceDaoBandanaPersister.java:76)
at com.atlassian.confluence.impl.bandana.ReadThroughCachingBandanaPersister.store(ReadThroughCachingBandanaPersister.java:144)
at com.atlassian.confluence.impl.bandana.ReadThroughCachingBandanaPersister.store(ReadThroughCachingBandanaPersister.java:122)
...
...
Despite following the steps in our KB Getting 'generate could not read a hi value java.sql.SQLException Invalid object name 'hibernate_unique_key' SQLException Error, the issue remains.
Cause
The root cause that prevents the Confluence setup to complete successfully is that MySQL Administrator is using "MySQL Group Replication" technology as clustering method is used in MySQL DB side, as part of their disaster recovery framework. This requires a primary key in every Confluence table, including HIBERNATE_UNIQUE_KEY table.
Unfortunately, InnoDB Cluster is not supported in Confluence at this point in time.
There is a suggestion opened to get this assessed by our Product Managers and Engineering teams under CONFSERVER-68724 - Getting issue details... STATUS
Solution
If you wish to be using MySQL database with your Confluence installation, you will need to disable the replication mode in order to overcome this issue.
As an alternative solution to get a disaster recovery solution in the Confluence repository side, Pgpool-II support was added to Confluence 8.7 for PostgreSQL database cluster as specified in Confluence 8.7 Release Notes. This support will also remain valid for our next Long Term Support release Confluence 9.2 as recently announced in our Atlassian Community: Announcing Confluence 9.2 as the next Long Term Support release