Uploaded image for project: 'Confluence Cloud'
  1. Confluence Cloud
  2. CONFCLOUD-33777

Space Export Containing Page Restriction Fails during import into Confluence with SQL Server

XMLWordPrintable

      NOTE: This bug report is for Confluence Cloud. Using Confluence Server? See the corresponding bug report.

      Steps to Reproduce:

      1. Setup Confluence with Microsoft SQL Server, PostGreSQL or MySQL
      2. Create a space
      3. Create a page
      4. Add restriction into the page you just created
      5. Export this space
      6. Import the exported space into Confluence instance that use Microsoft SQL Server as its database

      Expected Results:

      Confluence should be able to import this space as it could with Confluence that use PostGreSQL or MySQL database.

      Actual Results:

      Confluence with MS SQL server will failed to process the space import with the following stack traces:

      Caused by: org.xml.sax.SAXException: Error while importing backup: Hibernate operation: could not insert: [com.atlassian.confluence.security.ContentPermission#8323117]; SQL []; Violation of UNIQUE KEY constraint 'cp_unique_user_groups'. Cannot insert duplicate key in object 'dbo.CONTENT_PERM'. The duplicate key value is (8257543, View, <NULL>, <NULL>).; nested exception is java.sql.SQLException: Violation of UNIQUE KEY constraint 'cp_unique_user_groups'. Cannot insert duplicate key in object 'dbo.CONTENT_PERM'. The duplicate key value is (8257543, View, <NULL>, <NULL>).
      org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not insert: [com.atlassian.confluence.security.ContentPermission#8323117]; SQL []; Violation of UNIQUE KEY constraint 'cp_unique_user_groups'. Cannot insert duplicate key in object 'dbo.CONTENT_PERM'. The duplicate key value is (8257543, View, <NULL>, <NULL>).; nested exception is java.sql.SQLException: Violation of UNIQUE KEY constraint 'cp_unique_user_groups'. Cannot insert duplicate key in object 'dbo.CONTENT_PERM'. The duplicate key value is (8257543, View, <NULL>, <NULL>).
      	at com.atlassian.confluence.importexport.xmlimport.parser.BackupParser.endElement(BackupParser.java:53)

      Workaround 1

      Remove all page restrictions from the source Confluence before generating the space export. Then re-add the restrictions in the target instance after the import

      Workaround 2

      1. Drop the constraint in the target instance:
        ALTER TABLE CONTENT_PERM DROP CONSTRAINT cp_unique_user_groups;
        
      2. Restore the Space
      3. Re-add the constraint:
        ALTER TABLE CONTENT_PERM ADD CONSTRAINT [cp_unique_user_groups] UNIQUE NONCLUSTERED 
        (
        	[CPS_ID] ASC,
        	[CP_TYPE] ASC,
        	[USERNAME] ASC,
        	[GROUPNAME] ASC
        );
        

      Workaround 3

      Migrate your Confluence database server to other supported database.

              Unassigned Unassigned
              scahyadiputra Septa Cahyadiputra (Inactive)
              Votes:
              3 Vote for this issue
              Watchers:
              14 Start watching this issue

                Created:
                Updated:
                Resolved: