JIRA Upgrade Fails

I am looking to upgrade an environment which is as follows:

OS : SLES

JIRA VERSION : 5.2.11

Want to upgrade to 6.4.12

 

What is the best solution to get there. I am not asking the easier way out but would like to know if there is instead of going through the pain taking route of upgrading to every version between 5.2.11 and 6.4.12

 

Errors:

JIRA Access Constraints

You cannot access JIRA at present. 
DescriptionTimeLevelException
An error occurred performing JIRA upgrade

The data before the upgrade has been exported to /data/.../jira...104.zip
2016-01-04 11:31:04error
Exception thrown during upgrade: Could not create index: SQL Exception while executing the following:
CREATE UNIQUE INDEX issue_proj_num ON jiraissue (issuenum, PROJECT)
Error was: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '10-10712' for key 'issue_proj_num'
java.lang.RuntimeException: Could not create index: SQL Exception while executing the following:
CREATE UNIQUE INDEX issue_proj_num ON jiraissue (issuenum, PROJECT)
Error was: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '10-10712' for key 'issue_proj_num'
	at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6132.createIndex(UpgradeTask_Build6132.java:60)
	at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6132.doUpgrade(UpgradeTask_Build6132.java:50)
	at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeTaskSuccess(UpgradeManagerImpl.java:685)
	at com.atlassian.jira.upgrade.UpgradeManagerImpl.runUpgradeTasks(UpgradeManagerImpl.java:534)
	at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgrade(UpgradeManagerImpl.java:463)
	at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeeded(UpgradeManagerImpl.java:405)
	at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeededAndAllowed(UpgradeManagerImpl.java:340)
	at com.atlassian.jira.upgrade.UpgradeLauncher.checkIfUpgradeNeeded(UpgradeLauncher.java:106)
	at com.atlassian.jira.upgrade.UpgradeLauncher.start(UpgradeLauncher.java:54)
	at com.atlassian.jira.startup.ActiveServicesLauncher.start(ActiveServicesLauncher.java:42)
	at com.atlassian.jira.startup.DefaultJiraLauncher$3.run(DefaultJiraLauncher.java:132)
	at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:317)
	at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseActivated(DatabaseConfigurationManagerImpl.java:211)
	at com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:118)
	at com.atlassian.jira.startup.DefaultJiraLauncher.access$100(DefaultJiraLauncher.java:32)
	at com.atlassian.jira.startup.DefaultJiraLauncher$1.run(DefaultJiraLauncher.java:81)
	at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:34)
	at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:76)
	at com.atlassian.jira.startup.LauncherContextListener.contextInitialized(LauncherContextListener.java:54)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
	at java.lang.Thread.run(Thread.java:662)

 

I have gone thru this Link which does not work.

2 answers

1 accepted

This widget could not be displayed.

As I read it, the issue is that you have two issues with the same project/issuenum pair, "10-10712", in your mysql JIRA database.  Whether or not that means project 10, issue 10712, or project 10712, issue 10, is uncertain.  Either way, the only way to create that index is to change the issuenum(s) of the affected duplicates.

Step 1 would be to identify the rows.  Something like:

select count(*), issuenum, project from jiraissue group by issuenum, project having count(*) > 1;

From there, get the IDs of all matching records.  Assuming there's just the one, and it's issuenum 10, project 10712, it would be:

select id, summary from jiraissue where issuenum=10 and project=10712;

There should be multiple rows here.   The summary may help identify which one, if any, is legitimate.  If one is obviously incorrect, you can just delete it by ID:

delete from jiraissue where id=X;

That would certainly be easiest; the alternative is to grab the next available value for this project:

select pcounter from project where id=10712;

Followed by:

update jiraissue set issuenum=<project counter + 1> where id=X;
update project set pcounter=pcounter+1 where id=10712;

The second update is likely necessary to tell JIRA that the ID you just assigned has been used, otherwise I'd expect the next "create issue" attempt to fail.  However, I've not tested that case, it's just highly reasonable.

Actually, deleting the issue by ID would be incomplete, as you'd also have to delete all references. Adjusting the ID and deleting via the UI is the better approach, assuming the delete would even go through.

Oh, also... forget using the max ID as the next value, as then you could theoretically be re-using a deleted ID (unlikely, but possible). It would be best to use the definitive value in project, "select pcounter from project where id=10712", and add one to that instead.

This widget could not be displayed.

Hi Jeremy,

Thanks for the quick and accurate response.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted yesterday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

27 views 0 1
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you