ERROR: duplicate key value violates unique constraint "pk_os_historystep"

giulifed September 19, 2016

HI, i'e getting this error:

Could not move to history step for #12605: root cause: while inserting: [GenericEntity:OSHistoryStep][owner,][caller,admin][dueDate,null][stepId,1][actionId,11][finishDate,2016-09-19 16:41:50.744][id,12712][startDate,2016-09-19 16:30:38.133][entryId,12605][status,null] (SQL Exception while executing the following:INSERT INTO public.OS_HISTORYSTEP (ID, ENTRY_ID, STEP_ID, ACTION_ID, OWNER, START_DATE, DUE_DATE, FINISH_DATE, STATUS, CALLER) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_os_historystep"))

 

Any clues?

 

1 answer

0 votes
crf
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 19, 2016

This is a database corruption.

I'm not completely familiar with this part of the schema, but the fact that OSHistoryStep doesn't have its own entry in sequence_value_item leads me to believe that it is supposed to get its id from a moved OSCurrentStep rather than generating its own.  It would therefore be a problem if the same ID exists in both tables.  In other words, this query should return 0 rows:

SELECT id FROM os_historystep WHERE id IN (SELECT id FROM os_currentstep);

 

If it doesn't, then this would seem to be the problem.  But I'm not 100% certain how you got here or what the best way is to fix it.  If it were me, I'd probably take a backup of the database and then delete the offending rows from os_historystep.  That is, if you have your own JIRA Server or JIRA Data Center instance.

If you are in JIRA Cloud, there is a current incident related to problems in changes to the sequence value generation.  You should open a support request and include a reference to "HOT-47776" or this JRA:

https://jira.atlassian.com/browse/JRA-62558

 

Suggest an answer

Log in or Sign up to answer