views:

51

answers:

2

I have a JIRA environment which already has some information and i'm trying to merge all the bugzilla bugs into JIRA. I'm trying to use the importer form JIRA "BugzillaImportBean.java‎" But it's failing when it tries to insert into the OS_CURRENTSTEP table because of a unique Key violation, essentially the ID already exists in JIRA in that table.

So it crashes at final GenericValue issue = createIssue(resultSet, getProductName(resultSet, true), componentName);

Error importing data from Bugzilla: com.atlassian.jira.exception.CreateException: Could not create new current step for #259350: root cause: while inserting: [GenericEntity:OSCurrentStep][id,357430][startDate,2010-07-23 05:32:14.414][status,Open][owner,][finishDate,null][actionId,0][stepId,1][dueDate,null][entryId,259350] (SQL Exception while executing the following:INSERT INTO OS_CURRENTSTEP (ID, ENTRY_ID, STEP_ID, ACTION_ID, OWNER, START_DATE, DUE_DATE, FINISH_DATE, STATUS, CALLER) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (Duplicate entry '357430' for key 1))

What is the best way of fixing this? Bugzilla Database Schema: http://tldp.org/LDP/bugzilla/Bugzilla-Guide/dbschema.html Jira Database Schema: http://confluence.atlassian.com/display/JIRA/Database+Schema http://confluence.atlassian.com/display/JIRA/Modifying+the+Bugzilla+Importer

CREATE TABLE `OS_CURRENTSTEP` (
  `ID` decimal(18,0) NOT NULL,
  `ENTRY_ID` decimal(18,0) default NULL,
  `STEP_ID` decimal(9,0) default NULL,
  `ACTION_ID` decimal(9,0) default NULL,
  `OWNER` varchar(60) default NULL,
  `START_DATE` datetime default NULL,
  `DUE_DATE` datetime default NULL,
  `FINISH_DATE` datetime default NULL,
  `STATUS` varchar(60) default NULL,
  `CALLER` varchar(60) default NULL,
  PRIMARY KEY  (`ID`),
  KEY `wf_entryid` (`ENTRY_ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+1  A: 

Looks like the Bugzilla Importer has got confused about Status and Workflow steps. I can't remember if it tries to create new workflow steps on the fly? That importer is a right dog's breakfast, which is why I wrote my own product to do imports into JIRA. I'm doing another one tomorrow in fact.

Anyway, one way to narrow down the problem is to import a subset of issues. Perhaps you don't have the mapping from Bugzilla states (customized?) to JIRA statuses complete?

There's more info about the guts of this at http://confluence.atlassian.com/display/JIRA/Issue+status+and+workflow

~Matt

mdoar
"tries to create new workflow steps on the fly?"I don't think that is the case. Looking at the page you cited, Step is a small fixed integer, corresponding to Status.But it inserts an OS_CURRENTSTEP *row per issue*.
Vladimir Alexiev
+1  A: 
  1. The problem could be a duplicate sequence value. Check the SEQUENCE_VALUE_ITEM table, look for a row such as "OSCurrentStep" (if this is not the name, the mapping of tables to entity names is in WEB-INF/classes/entitydefs/entitymodel.xml)

    select * from SEQUENCE_VALUE_ITEM where SEQ_NAME='OSCurrentStep'

    • Check what is the maximal used value: select MAX(ID) from OS_CURRENTSTEP

    • Set SEQ_ID bigger than the maximal used value, rounding up to a multiple of 10. (Described in http://confluence.atlassian.com/display/JIRA/Database+Schema # SEQUENCE_VALUE_ITEM)

    • The failed duplicate key '357430' is a multiple of 10, which suggests this is the reason

  2. An easier but less likely solution: are you trying to import the same issue a second time?

    If so, then "click the 'Import only new issues' checkbox in the importer" as described here: http://confluence.atlassian.com/display/JIRA/Importing+Data+from+Bugzilla

    • (You will notice that the failed statement is inside this condition: if (!onlyNewIssues || !previouslyImportedKeys.containsKey...)
Vladimir Alexiev