Uploaded image for project: 'Migration Platform'
  1. Migration Platform
  2. MIG-1118

XML export from Cloud to Server fails to import

    XMLWordPrintable

Details

    • 11
    • Severity 1 - Critical

    Description

      Issue Summary

      The restore from Cloud to Server fails with the following message in the logs:

      2021-06-10 18:48:34,456-0300 JiraImportTaskExecutionThread-1 ERROR diegovb 1128x309x1 1rrq5kr 0:0:0:0:0:0:0:1 /secure/admin/XmlRestore.jspa [c.a.j.bc.dataimport.DefaultDataImportService] Error during ActiveObjects restore
      com.atlassian.activeobjects.spi.ActiveObjectsImportExportException: There was an error during import/export with <unknown plugin>:Error executing update for SQL statement 'ALTER TABLE public."AO_2C4E5C_MAILBLOCKLISTS" ADD CONSTRAINT "fk_ao_2c4e5c_mailblocklists_project_id" FOREIGN KEY ("PROJECT_ID") REFERENCES public."PROJECT"("ID")'
      	at com.atlassian.activeobjects.backup.ImportExportErrorServiceImpl.newImportExportSqlException(ImportExportErrorServiceImpl.java:26)
      	at com.atlassian.activeobjects.backup.SqlUtils.onSqlException(SqlUtils.java:46)
      	at com.atlassian.activeobjects.backup.SqlUtils.executeUpdate(SqlUtils.java:37)
      	at com.atlassian.activeobjects.backup.ActiveObjectsForeignKeyCreator.create(ActiveObjectsForeignKeyCreator.java:43)
      	at com.atlassian.activeobjects.backup.ForeignKeyAroundImporter.after(ForeignKeyAroundImporter.java:26)
      	at com.atlassian.dbexporter.importer.AbstractImporter.importNode(AbstractImporter.java:47)
      	at com.atlassian.dbexporter.DbImporter.importData(DbImporter.java:70)
      	at com.atlassian.activeobjects.backup.ActiveObjectsBackup.restore(ActiveObjectsBackup.java:151)
      	at com.atlassian.jira.bc.dataimport.DefaultDataImportService.restoreActiveObjects(DefaultDataImportService.java:574)
      	at com.atlassian.jira.bc.dataimport.DefaultDataImportService.performImport(DefaultDataImportService.java:749)
      	at com.atlassian.jira.bc.dataimport.DefaultDataImportService.doImport(DefaultDataImportService.java:323)
      	at com.atlassian.jira.web.action.setup.DataImportAsyncCommand.unsafeCall(DataImportAsyncCommand.java:82)
      	at com.atlassian.jira.web.action.setup.DataImportAsyncCommand.call(DataImportAsyncCommand.java:64)
      	at com.atlassian.jira.web.action.setup.DataImportAsyncCommand.call(DataImportAsyncCommand.java:30)
      	at com.atlassian.jira.task.ImportTaskManagerImpl$TaskCallableDecorator.call(ImportTaskManagerImpl.java:177)
      	at com.atlassian.jira.task.ImportTaskManagerImpl$TaskCallableDecorator.call(ImportTaskManagerImpl.java:149)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: org.postgresql.util.PSQLException: ERROR: relation "public.PROJECT" does not exist
      	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2468)
      	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2211)
      	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:309)
      	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:446)
      	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:370)
      	at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:297)
      	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:274)
      	at org.postgresql.jdbc.PgStatement.executeUpdate(PgStatement.java:246)
      
      	at com.atlassian.activeobjects.backup.SqlUtils.executeUpdate(SqlUtils.java:34)
      	... 19 more

      the downloaded file contains a foreignKey reference to the table project, column id. However, the table and column name are in uppercase:

      <foreignKey fromTable="AO_2C4E5C_MAILBLOCKLISTS" fromColumn="PROJECT_ID" toTable="PROJECT" toColumn="ID" />
      

      This leads to errors when importing on Jira Server. 

      (Similar old bug: https://jira.atlassian.com/browse/JRASERVER-69564)

      However, the entire table is not needed on Jira server; it is only used on Jira Cloud.

       

      Steps to Reproduce

      1. Export a backup via Setttings -> System -> Backup manager -> Create backup for server
      2. Download and unzip the export file
      3. Inside the unzipped folder, examine activeobjects.xml
      4. It contains a reference to the table AO_2C4E5C_MAILBLOCKLISTS including the foreignKey causing issues during import.

      Expected Results

      The table AO_2C4E5C_MAILBLOCKLISTS should not be exported to Jira Server.

      Actual Results

      Workaround

      The problematic line has to be removed from activeobjects.xml file:

          <foreignKey fromTable="AO_2C4E5C_MAILBLOCKLISTS" fromColumn="PROJECT_ID" toTable="PROJECT" toColumn="ID"/>
      

      The following steps can be used to perform and validate this change:

      1. Unzip cloud backup
      unzip cloudbackup.zip 
      Archive: cloudbackup.zip
       inflating: entities.xml
       inflating: activeobjects.xml
      1. Expand xml to multiple lines:
      xmllint activeobjects.xml --format > activeobjects_fixed.xml && mv activeobjects_fixed.xml 
      activeobjects.xml 
      1. Remove the foreign key entry.
      2. Zip backup back together.
      zip -r cloudbackup_fixed.zip activeobjects.xml entities.xml
      1. Move the backup to the import directory on the destination instance and perform the import

      Attachments

        Issue Links

          Activity

            People

              03fbff95107f Biren Goyal
              dbaeza@atlassian.com Diego Baeza
              Votes:
              14 Vote for this issue
              Watchers:
              22 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: