Uploaded image for project: 'Confluence Server'
  1. Confluence Server
  2. CONFSERVER-44257

Cannot delete spaces which were imported from Cloud

    Details

    • Symptom Severity:
      Minor
    • Support reference count:
      3

      Description

      Summary

      When we try to delete a space which was imported from a Cloud version then the import does not complete and we see a foreign key violation on the table usercontent_relation in the logs

      Environment

      Cloud version
      Confluence 5.10.x

      Steps to Reproduce

      1. Export a space from cloud version
      2. Import it to Confluence 5.10.x
      3. Delete the imported space

      Expected Results

      The space should be deleted

      Actual Results

      The below exception is thrown in the atlassian-confluence.log file and space does not get deleted the progress is stuck at some point:

      2016-10-07 21:51:50,457 ERROR [Long running task: Space removal long running task] [atlassian.confluence.event.ConfluenceEventDispatcher] lambda$getRunnable$1 There was an exception thrown trying to dispatch event [com.atlassian.confluence.event.events.space.SpaceWillRemoveEvent[source=com.atlassian.confluence.spaces.DefaultSpaceManager@422da8a5]] from the invoker [com.atlassian.confluence.event.ConfluenceListenerHandlersConfiguration$TimingListenerHandler$1$1@43b5b300]
       -- space: 98307 | url: /spaces/doremovespace.action | traceId: 187467d29377f21f | userName: admin | referer: http://localhost:8090/spaces/removespace.action?key=MIZ | action: doremovespace
      java.lang.RuntimeException: Hibernate operation: could not delete: [com.atlassian.confluence.pages.Page#65601]; SQL []; ERROR: update or delete on table "content" violates foreign key constraint "fkecd19ced351d64c3" on table "usercontent_relation"
        Detail: Key (contentid)=(65601) is still referenced from table "usercontent_relation".; nested exception is org.postgresql.util.PSQLException: ERROR: update or delete on table "content" violates foreign key constraint "fkecd19ced351d64c3" on table "usercontent_relation"
        Detail: Key (contentid)=(65601) is still referenced from table "usercontent_relation".
      
      
      

      Workaround

      Please take a Db backup and throughly test the below workaround before applying it to production instance

      A workaround is to truncate the table

      truncate usercontent_relation;
      
      Query MSSQL
      TRUNCATE table USERCONTENT_RELATION;
      

        Attachments

          Activity

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Last commented:
                42 weeks, 3 days ago