Upgrade Fails Due to Previously Failed Upgrade Attempt on Same JIRA Instance
Symptoms
An upgraded JIRA instance fails to start up and displays the following message in the log files:
[c.a.jira.upgrade.UpgradeManagerImpl] Problem adding upgrade task Drops the entityproperty_identity index in entity_property table to the upgrade history
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,10820][status,complete] (SQL Exception while executing the following:INSERT INTO upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (Duplicate entry 'com.atlassian.jira.upgrade.tasks.UpgradeTask_Build64016' for key 'PRIMARY'))
at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:398)
at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.createValue(WrappingOfBizDelegator.java:219)
at com.atlassian.jira.upgrade.UpgradeManagerImpl.addToUpgradeHistory(UpgradeManagerImpl.java:966)
Caused by: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:INSERT INTO upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (Duplicate entry 'com.atlassian.jira.upgrade.tasks.UpgradeTask_Build64016' for key 'PRIMARY')
at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:684)
at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:205)
Cause
The instance you are attempting to upgrade has already had one upgrade attempt against it. What has happened is that the database has not been properly rolled back to the state prior to the original upgrade attempt which causes a conflict when creating new tables.
Resolution
Ensure that the home directory and database are returned to the state from before the original upgrade attempt.