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;
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
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
if (!onlyNewIssues || !previouslyImportedKeys.containsKey...
)