Uploaded image for project: 'Jira Cloud'
  1. Jira Cloud
  2. JRACLOUD-79495

Import fails if the export contains upgrade task "Pending" in the upgrade history

    XMLWordPrintable

Details

    Description

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

      Summary

      During a JIRA import, if the export is from a JIRA that has a pending upgrade task in the database, this entry is migrated and causes the JIRA Upgrade task (after the import) to fail and permanently Lock JIRA.

      Steps to Reproduce

      Upgrade Tasks may appear as "Pending" in the upgradehistory db table if the DelayedUpgradeJobRunner introduced in JIRA 6.4 delayed the task.

      1. Export a JIRA that has a "Pending" task in the upgradehistory table.
      2. Import to latest JIRA

      Expected Results

      JIRA imports and runs upgrade tasks

      Actual Results

      Update: 7/7/2016 - JIRA will allow the export, but will raise a validation error before beginning to import the backup file. This should allow the workaround to be applied directly and the import restarted.

      Under the previous behaviour JIRA imports data but fails to run upgrade tasks with the following error in the logs:

      2016-02-18 11:55:59.008981500 2016-02-18 11:55:59,008 JiraImportTaskExecutionThread-1 ERROR sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.jira.upgrade.ConsistencyCheckImpl] Could not find Mail Queue Service, adding.
      2016-02-18 11:55:59.026175500 2016-02-18 11:55:59,026 JiraImportTaskExecutionThread-1 INFO sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.jira.upgrade.ConsistencyCheckImpl] The Server ID for this JIRA instance is: [BJEV-O0EK-BZH3-N1YN]
      2016-02-18 11:55:59.026836500 2016-02-18 11:55:59,026 JiraImportTaskExecutionThread-1 INFO sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.j.bc.dataimport.DefaultDataImportService] Importing data is 92% complete...
      2016-02-18 11:55:59.265240500 2016-02-18 11:55:59,265 JiraImportTaskExecutionThread-1 INFO sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.jira.upgrade.UpgradeManagerImpl] Detected that an upgrade is needed; existing data at build 64015
      2016-02-18 11:55:59.265681500 2016-02-18 11:55:59,265 JiraImportTaskExecutionThread-1 INFO sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.jira.upgrade.UpgradeManagerImpl] ___ Performing Upgrade ____________________
      2016-02-18 11:55:59.368595500 2016-02-18 11:55:59,368 JiraImportTaskExecutionThread-1 INFO sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.jira.upgrade.UpgradeManagerImpl] Performing Upgrade Task: Drops the entityproperty_identity index in entity_property table
      2016-02-18 11:55:59.376612500 2016-02-18 11:55:59,374 JiraImportTaskExecutionThread-1 ERROR sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.jira.upgrade.UpgradeManagerImpl] Problem adding upgrade task Drops the entityproperty_identity index in entity_property table to the upgrade history
      2016-02-18 11:55:59.376614500 com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:UpgradeHistory][targetbuild,64016][upgradeclass,com.atlassian.jira.upgrade.tasks.UpgradeTask_Build64016][downgradetaskrequired,Y][id,10700][status,complete] (SQL Exception while executing the following:INSERT INTO public.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_upgradehistory"))
      2016-02-18 11:55:59.376628500 	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:299)
      2016-02-18 11:55:59.376628500 	at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.createValue(WrappingOfBizDelegator.java:172)
      2016-02-18 11:55:59.376633500 	at com.atlassian.jira.upgrade.UpgradeManagerImpl.addToUpgradeHistory(UpgradeManagerImpl.java:859)
      2016-02-18 11:55:59.376633500 	at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeTaskSuccess(UpgradeManagerImpl.java:726)
      2016-02-18 11:55:59.376633500 	at com.atlassian.jira.upgrade.UpgradeManagerImpl.runUpgradeTasks(UpgradeManagerImpl.java:609)
      2016-02-18 11:55:59.376634500 	at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgrade(UpgradeManagerImpl.java:493)
      2016-02-18 11:55:59.376637500 	at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeeded(UpgradeManagerImpl.java:435)
      2016-02-18 11:55:59.376637500 	at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeededAndAllowed(UpgradeManagerImpl.java:379)
      2016-02-18 11:55:59.376638500 	at com.atlassian.jira.bc.dataimport.DefaultDataImportService.upgradeJira(DefaultDataImportService.java:833)
      2016-02-18 11:55:59.376638500 	at com.atlassian.jira.bc.dataimport.DefaultDataImportService.performImport(DefaultDataImportService.java:739)
      2016-02-18 11:55:59.376641500 	at com.atlassian.jira.bc.dataimport.DefaultDataImportService.doImport(DefaultDataImportService.java:320)
      2016-02-18 11:55:59.376642500 	at com.atlassian.jira.studio.importer.StudioDataImportAsyncCommand.importJiraExportData(StudioDataImportAsyncCommand.java:182)
      2016-02-18 11:55:59.376647500 	at com.atlassian.jira.studio.importer.StudioDataImportAsyncCommand.importDataAndFiles(StudioDataImportAsyncCommand.java:169)
      2016-02-18 11:55:59.376648500 	at com.atlassian.jira.studio.importer.StudioDataImportAsyncCommand.call(StudioDataImportAsyncCommand.java:120)
      2016-02-18 11:55:59.376649500 	at com.atlassian.jira.studio.importer.StudioDataImportAsyncCommand.call(StudioDataImportAsyncCommand.java:61)
      2016-02-18 11:55:59.376656500 	at com.atlassian.jira.task.ImportTaskManagerImpl$TaskCallableDecorator.call(ImportTaskManagerImpl.java:157)
      2016-02-18 11:55:59.376656500 	at com.atlassian.jira.task.ImportTaskManagerImpl$TaskCallableDecorator.call(ImportTaskManagerImpl.java:133)
      2016-02-18 11:55:59.376657500 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      2016-02-18 11:55:59.376657500 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      2016-02-18 11:55:59.376668500 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      2016-02-18 11:55:59.376669500 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      2016-02-18 11:55:59.376669500 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      2016-02-18 11:55:59.376670500 	at java.lang.Thread.run(Thread.java:745)
      2016-02-18 11:55:59.376670500 Caused by: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:UpgradeHistory][targetbuild,64016][upgradeclass,com.atlassian.jira.upgrade.tasks.UpgradeTask_Build64016][downgradetaskrequired,Y][id,10700][status,complete] (SQL Exception while executing the following:INSERT INTO public.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_upgradehistory"))
      2016-02-18 11:55:59.376682500 	at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:213)
      2016-02-18 11:55:59.376683500 	at org.ofbiz.core.entity.GenericDAO.insert(GenericDAO.java:178)
      2016-02-18 11:55:59.376683500 	at org.ofbiz.core.entity.GenericHelperDAO.create(GenericHelperDAO.java:83)
      2016-02-18 11:55:59.376683500 	at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:556)
      2016-02-18 11:55:59.376684500 	at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:542)
      2016-02-18 11:55:59.376684500 	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:296)
      2016-02-18 11:55:59.376687500 	... 22 more
      2016-02-18 11:55:59.376687500 Caused by: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:INSERT INTO public.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_upgradehistory")
      2016-02-18 11:55:59.376692500 	at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:683)
      2016-02-18 11:55:59.376692500 	at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:205)
      2016-02-18 11:55:59.376695500 	... 28 more
      2016-02-18 11:55:59.376696500 Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "pk_upgradehistory"
      2016-02-18 11:55:59.376696500 	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2077)
      2016-02-18 11:55:59.376697500 	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
      2016-02-18 11:55:59.376697500 	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:498)
      2016-02-18 11:55:59.376700500 	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:386)
      2016-02-18 11:55:59.376700500 	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:332)
      2016-02-18 11:55:59.376701500 	at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:97)
      2016-02-18 11:55:59.376705500 	at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:97)
      2016-02-18 11:55:59.376706500 	at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:673)
      2016-02-18 11:55:59.376706500 	... 29 more
      2016-02-18 11:55:59.384740500 2016-02-18 11:55:59,384 JiraImportTaskExecutionThread-1 ERROR sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.jira.upgrade.UpgradeManagerImpl] Errors occurred during upgrade:
      2016-02-18 11:55:59.384987500 2016-02-18 11:55:59,384 JiraImportTaskExecutionThread-1 ERROR sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.jira.upgrade.UpgradeManagerImpl] Upgrade Error: There was a problem adding Upgrade Task Drops the entityproperty_identity index in entity_property table to the Upgrade History. This means the state of the system may be out of sync with the upgrade history, which could result in missed downgrade tasks for future exports.
      2016-02-18 11:55:59.385238500 2016-02-18 11:55:59,385 JiraImportTaskExecutionThread-1 INFO sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.j.bc.dataimport.DefaultDataImportService] Importing data is 96% complete...
      2016-02-18 11:55:59.388671500 2016-02-18 11:55:59,388 JiraImportTaskExecutionThread-1 WARN sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.j.p.d.dao.impl.CachingOrganizationDaoImpl] onImportCompleted - clearing cache !!
      2016-02-18 11:55:59.389198500 2016-02-18 11:55:59,389 JiraImportTaskExecutionThread-1 INFO sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.j.bc.dataimport.DefaultDataImportService] Importing data is 100% complete...
      2016-02-18 11:55:59.389351500 2016-02-18 11:55:59,389 JiraImportTaskExecutionThread-1 INFO sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.j.bc.dataimport.DefaultDataImportService] JIRA Data Import has finished.
      2016-02-18 11:55:59.389574500 2016-02-18 11:55:59,389 JiraImportTaskExecutionThread-1 WARN sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.j.studio.importer.StudioImport] FULL JIRA Import result is not valid.
      2016-02-18 11:55:59.391667500 2016-02-18 11:55:59,391 JiraImportTaskExecutionThread-1 INFO sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.j.studio.importer.StudioImport] Import finished
      I found the following entry on the entities.xml
      

      JIRA is locked.

      Notes

      On that particular case the following entry is found in the "entities.xml"

      <UpgradeHistory id="10639" upgradeclass="com.atlassian.jira.upgrade.tasks.UpgradeTask_Build64016" targetbuild="64016" status="pending"/>
      

      The export was from a JIRA build 64016

      Workaround

      • Search for the UpgradeTask_Build number in the entities.xml
      • If it is in "Pending" status, remove the entry and any other "Pending" tasks.
      • Recover JIRA and import again

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mfernandezbadii Mauro Badii
              Votes:
              2 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: