Details
-
Bug
-
Resolution: Unresolved
-
Low
-
None
-
8.3.0, 7.19.9
-
None
-
2
-
Severity 3 - Minor
-
Description
Issue Summary
When importing a Confluence Cloud space to On-Prem, the space import fails with the following error:
Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "u2c_relation_unique"
Detail: Key (targetcontentid, sourceuser, relationname)=(xxxxxxx, xxxxxxxxxxxxxxxxxxx, collaborator) already exists.
This is reproducible on Data Center: yes
Steps to Reproduce
Confluence Cloud
- Create two users on Confluence Cloud with email addresses abc@mail.com and def@mail.com
- Have both users modify the same content
- Export the Confluence Cloud space
Confluence On-Prem
- Have two users from two different directories (e.g. Confluence Internal Directory and AD/LDAP) with the same username (e.g. user1) but with different email addresses in both directories
Email addresses should match the email address of the users in Confluence Cloud - Perform the space import
Expected Results
Space Import is successful
Actual Results
Import fails with the following error
2023-07-05 07:35:45,740 ERROR [Long running task: Importing data] [confluence.importexport.actions.ImportLongRunningTask] runInternal Failure during import -- url: /confluence/admin/restore.action | userName: admin | action: restore | referer: https://linux-45853.prod.atl-cd.net/confluence/admin/backup.action | traceId: 22bb5a5608e1dd1f com.atlassian.confluence.importexport.ImportExportException: com.atlassian.confluence.importexport.ImportExportException: Unable to complete import: Error while importing backup: org.hibernate.exception.ConstraintViolationException: could not execute statement at com.atlassian.confluence.importexport.xmlimport.BackupImporter.importEntities(BackupImporter.java:431) at com.atlassian.confluence.importexport.xmlimport.BackupImporter.importEverything(BackupImporter.java:392) at com.atlassian.confluence.importexport.xmlimport.FileBackupImporter.importEverything(FileBackupImporter.java:172) at com.atlassian.confluence.importexport.xmlimport.BackupImporter$1.doInTransactionWithoutResult(BackupImporter.java:284) ... Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "u2c_relation_unique" Detail: Key (targetcontentid, sourceuser, relationname)=(2457636, 2cb280848924dc26018924f0737f0000, collaborator) already exists. at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2676) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2366) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:356) at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:496) at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:413) at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:190) at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:152)
This happens if both user accounts (two different email addresses) on Confluence Cloud share the same username on Confluence On-Prem.
Workaround
- Rename the username for one of the account; OR
- Delete one of the duplicate account that is no longer needed
Diagnosis
Run the SQL verify if the affected userKey from the logs has two records with the same username but different email addresses
select cu.user_name, cu.email_address, cu.active, cu.directory_id from cwd_user cu inner join user_mapping um on um.username = cu.user_name where um.user_key = '<userKey>'
To verify if there are many users that might be impacted by this, you can run the SQL query below:
select user_name, email_address, active, directory_id from cwd_user cu where cu.user_name in ( select user_name from cwd_user group by user_name having count(user_name) > 1);
Attachments
Issue Links
- is related to
-
CONFSERVER-56054 Importing content relations from shadowed users fails
- Closed