Site import in Confluence fails with error: update or delete on table "user_mapping" violates foreign key constraint "fk_spacepermissions_creator" on table "spacepermissions"

XMLWordPrintable

    • 1
    • Severity 3 - Minor

      Issue Summary

      When trying to import site backup from Server to Cloud, the site import fails with below error:

       message: ERROR: update or delete on table "user_mapping" violates foreign key constraint "fk_spacepermissions_creator" on table "spacepermissions"
        Detail: Key (user_key)=(8a7f808a6d6e6c3a016d9735a6490078) is still referenced from table "spacepermissions".

      Environment

      • Confluence Server
      • Confluence Cloud

      Steps to Reproduce

      1. Create a site backup from your Confluence Server and import it into your Cloud instance.
      2. The import will fail.

      Expected Results

      The import should be successful.

      Actual Results

      Import fails and the below exceptions are thrown:
      1.

       stack: org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [fk_spacepermissions_creator]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement
      org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:247)
      org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:391)
      org.springframework.orm.hibernate5.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:350)
      com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao.findNamedQueryStringParams(HibernateObjectDao.java:401)
      com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao.findNamedQueryStringParam(HibernateObjectDao.java:334)
      com.atlassian.confluence.user.persistence.dao.hibernate.HibernatePersonalInformationDao.getAllByUser(HibernatePersonalInformationDao.java:60)
      com.atlassian.confluence.user.persistence.dao.CachingPersonalInformationDao.getAllByUser(CachingPersonalInformationDao.java:90)
      com.atlassian.confluence.user.DefaultPersonalInformationManager.removePersonalInformation(DefaultPersonalInformationManager.java:126)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      java.lang.reflect.Method.invoke(Method.java:498)
       message: Runtime exception inside a transaction, marking rollback-only

      2.

       stack: java.lang.RuntimeException: org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [fk_spacepermissions_creator]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement
      com.atlassian.ondemand.confluenceimporter.service.importer.SiteImportTaskRunnerImpl.blowAwayExistingData(SiteImportTaskRunnerImpl.java:532)
      com.atlassian.ondemand.confluenceimporter.service.importer.SiteImportTaskRunnerImpl.doImport(SiteImportTaskRunnerImpl.java:344)
      com.atlassian.ondemand.confluenceimporter.service.importer.SiteImportTaskRunnerImpl.runInternal(SiteImportTaskRunnerImpl.java:277)
      com.atlassian.ondemand.confluenceimporter.service.importer.SiteImportTaskRunnerImpl.lambda$runImport$6(SiteImportTaskRunnerImpl.java:913)
      com.atlassian.confluence.core.flags.ImportRunningThreadLocalFlag.executeCallable(ImportRunningThreadLocalFlag.java:31)
      com.atlassian.ondemand.confluenceimporter.service.importer.SiteImportTaskRunnerImpl.runImport(SiteImportTaskRunnerImpl.java:913)
      com.atlassian.ondemand.confluenceimporter.service.importer.SiteImportTaskRunnerImpl.lambda$runTask$5(SiteImportTaskRunnerImpl.java:877)
      cloud.atlassian.logmon.datadog.publisher.internal.TaggedFunctionalTimeRecorder.with(TaggedFunctionalTimeRecorder.java:30)
       message: Error importing site

      3.

      message: ERROR: update or delete on table "user_mapping" violates foreign key constraint "fk_spacepermissions_creator" on table "spacepermissions"
        Detail: Key (user_key)=(8a7f808a6d6e6c3a016d9735a6490078) is still referenced from table "spacepermissions".

      Workaround

      Import the site backup to a temporary Server instance and then use Confluence Cloud Migration Assistant to migrate spaces to Cloud

            Assignee:
            Vladimir Churyukin
            Reporter:
            Saif
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: