-
Bug
-
Resolution: Fixed
-
Low
-
None
-
None
-
None
-
Severity 2 - Major
Issue Summary
Re-linking a cloud site causes ConstraintViolationException
Environment
- Latest Cloud Migration Assistant for Confluence (CMAC)
Steps to Reproduce
- Link cloud site https://aaa.atlassian.net in CMAC and perform a test migration
- After some time https://aaa.atlassian.net expires and is removed
- Provision a new cloud site with the same name https://aaa.atlassian.net (cloudId is changed at this stage; it is basically a new site but with the same hostname)
- Re-link https://aaa.atlassian.net in CMAC
Expected Results
Cloud site can be re-linked and migration can continue.
Actual Results
The below exception is thrown in the atlassian-confluence.log file:
javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute statement at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:149) caused by: org.hibernate.exception.ConstraintViolationException: could not execute statement at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:112) caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "mig_cloud_site_cloudurl_key" Detail: Key (cloudurl)=(https://aaa.atlassian.net) already exists. at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2476)
and
2019-07-23 17:10:40,459 ERROR [http-nio-8090-exec-7] [engine.jdbc.spi.SqlExceptionHelper] doLog ERROR: duplicate key value violates unique constraint "mig_cloud_site_cloudurl_key" Detail: Key (cloudurl)=(https://aaa.atlassian.net) already exists. -- url: /confluence/admin/save-cloud-site.action | traceId: 645a7762af5960c7 | userName: admin | action: save-cloud-site 2019-07-23 17:10:40,462 ERROR [http-nio-8090-exec-7] [org.hibernate.internal.ExceptionMapperStandardImpl] doLogf HHH000346: Error during managed flush [org.hibernate.exception.ConstraintViol ationException: could not execute statement] -- url: /confluence/admin/save-cloud-site.action | traceId: 645a7762af5960c7 | userName: admin | action: save-cloud-site 2019-07-23 17:10:40,467 WARN [http-nio-8090-exec-7] [confluence.impl.hibernate.ConfluenceHibernateTransactionManager] doRollback Performing rollback. Transactions: ->[null]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT (Session #2077325595) -- url: /confluence/admin/save-cloud-site.action | traceId: 645a7762af5960c7 | userName: admin 2019-07-23 17:10:40,468 ERROR [http-nio-8090-exec-7] [atlassian.confluence.servlet.ConfluenceServletDispatcher] sendError Could not execute action -- url: /confluence/admin/save-cloud-site.action | traceId: 645a7762af5960c7 | userName: admin javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute statement at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:149) at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:157) at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:164) at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1460) at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:511) at org.hibernate.internal.SessionImpl.flushBeforeTransactionCompletion(SessionImpl.java:3283)
Workaround
Follow the steps in Restore the Cloud Migration Assistant for Confluence to the default version and reinstall latest CMAC.