Unable to migrate from JIRA 5.x to JIRA 6.x and above

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.

 

Problem

Unable to migrate JIRA from old 5.X JIRA to newer JIRA 6.x version

  • Duplicated issue key can be observe in logs

The following appears in the atlassian-jira.log

localhost-startStop-1 ERROR      [atlassian.jira.upgrade.UpgradeManagerImpl] Exception thrown during upgrade: Could not create index: SQL Exception while executing the following:
CREATE UNIQUE INDEX issue_proj_num ON public.jiraissue (issuenum, PROJECT)
Error was: org.postgresql.util.PSQLException: ERROR: could not create unique index "issue_proj_num"
  Detail: Key (issuenum, project)=(0, 10251) is duplicated.
java.lang.RuntimeException: Could not create index: SQL Exception while executing the following:
CREATE UNIQUE INDEX issue_proj_num ON public.jiraissue (issuenum, PROJECT)
Error was: org.postgresql.util.PSQLException: ERROR: could not create unique index "issue_proj_num"
  Detail: Key (issuenum, project)=(0, 10251) is duplicated.
	at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6132.createIndex(UpgradeTask_Build6132.java:64)
	at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6132.doUpgrade(UpgradeTask_Build6132.java:54)
	at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeTaskSuccess(UpgradeManagerImpl.java:814)
	at com.atlassian.jira.upgrade.UpgradeManagerImpl.runUpgradeTasks(UpgradeManagerImpl.java:681)
	at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgrade(UpgradeManagerImpl.java:540)
	at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeeded(UpgradeManagerImpl.java:475)
	at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeededAndAllowed(UpgradeManagerImpl.java:410)
	at com.atlassian.jira.upgrade.UpgradeLauncher.checkIfUpgradeNeeded(UpgradeLauncher.java:107)
	at com.atlassian.jira.upgrade.UpgradeLauncher.start(UpgradeLauncher.java:55)
	at com.atlassian.jira.startup.ActiveServicesLauncher.start(ActiveServicesLauncher.java:49)
	at com.atlassian.jira.startup.DefaultJiraLauncher$3.run(DefaultJiraLauncher.java:140)
	at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:345)
	at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseActivated(DatabaseConfigurationManagerImpl.java:215)
	at com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:124)
	at com.atlassian.jira.startup.DefaultJiraLauncher.access$100(DefaultJiraLauncher.java:33)
	at com.atlassian.jira.startup.DefaultJiraLauncher$1.run(DefaultJiraLauncher.java:86)
	at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:34)
	at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:81)
	at com.atlassian.jira.startup.LauncherContextListener.contextInitialized(LauncherContextListener.java:72)  <+5> (StandardContext.java:4992) (StandardContext.java:5490) (LifecycleBase.java:150) (ContainerBase.java:1575) (ContainerBase.java:1565)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

Cause

This is due to previous JIRA 5.x version is having different column in jiraissue table. 

  • Issue key and project key is stored in one column
  • Where as in newer JIRA, issue key (issuenum) and project key(project) is seperated

 

Environment

  • Perform the following SQL to verify once you have restore the old instance to the new instance, if there is value returned , then proceed to the solution
  • select issuenum, project from jiraissue group by issuenum, project having count(*) > 1;

 

Resolution

Perform the following SQL update to update the issue number accordingly

  • Proceed to restore to the latest intended JIRA version
  • Run the following SQL for all the returned query

  • UPDATE jiraissue SET issuenum = (SELECT pcounter+1 FROM project WHERE id = 'YYYY') 
    WHERE id = (SELECT max(id) FROM jiraissue WHERE project = 'YYYY' AND issuenum = 'xxxx');
    UPDATE project SET pcounter = pcounter+1 WHERE id = 'YYYY';

    subtitute XXXX with the issuenum that is return from

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

    and YYYY from the project

  • Run the update until query return null

  • Scripting may be needed if large amount of data need to be altered to generate the update SQL


 

Last modified on Mar 30, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.