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

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server と Data Center のみ - この記事は、サーバーおよびデータセンター プラットフォームのアトラシアン製品にのみ適用されます。

 

問題

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

  • Duplicated issue key can be observe in logs

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)

原因

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

 

環境

  • 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;

 

ソリューション

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


 

最終更新日 2016 年 3 月 30 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.