-
Bug
-
Resolution: Fixed
-
High
-
None
-
13
-
Major
-
11
-
Issue Summary
Exporting a backup of a Jira Cloud instance for Server/DC includes a foreign key constraint for a table which doesn't exist, causing the restore to fail on Server/DC when running the import.
This is reproducible on Data Center: Yes
Steps to Reproduce
- Generate XML backup of Cloud backup for Server/DC
- Restore Cloud backup on Jira DC
Expected Results
Jira restore completes successfully
Actual Results
Import fails during active objects restore:
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>:E rror executing update for SQL statement 'ALTER TABLE public."AO_60DB71_LEXORANK" ADD CONSTRAINT "fk_ao_60db71_lexorank_field_id" FO REIGN KEY ("FIELD_ID") REFERENCES public."LEXORANK_FIELD_ID"("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.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829) Caused by: org.postgresql.util.PSQLException: ERROR: relation "public.LEXORANK_FIELD_ID" does not exist at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2552) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2284) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:322) at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:481) at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:401) at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:308) at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:284) at org.postgresql.jdbc.PgStatement.executeUpdate(PgStatement.java:258) at org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
Workaround
- Check activeobjects.xml to see if table LEXORANK_FIELD_ID exists
- If table does not exist, remove the following line from activeobjects.xml:
<foreignKey fromTable="AO_60DB71_LEXORANK" fromColumn="FIELD_ID" toTable="LEXORANK_FIELD_ID" toColumn="ID" />
- After removing above line, check and confirm no other references to LEXORANK_FIELD_ID shows up in activeobjects.xml
- Save changes and create new Jira XML backup Zip with modified XML file
- Import modified Jira backup