Issue Operations are Failed by the PK Violation of Database
Platform Notice: Data Center Only - This article only applies to Atlassian apps on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Symptom
Unable to do any action on issue, including Edit, Assign, Transit... along with the Primary Key Violation Exception thrown in log file.
SQL Exception while executing the following:
INSERT INTO ***.changegroup (ID, issueid, AUTHOR, CREATED) VALUES (?, ?, ?, ?) (***: unique constraint (***.PK_CHANGEGROUP) violated )
Cause
The cause is the dis-synchronization between the sequence setting and seq_id of changegroup table, which may relate to the incomplete transaction triggered by database connection failure.
Workaround
Warning: Backup your database before proceeding.
This article describes how to run SQL UPDATE statements directly against the Confluence database to replace hard-coded links. UPDATE statements are not reversible — any mistake will modify your live data permanently. Before running any SQL in this article, create a full backup of your Confluence database. Test the queries in a staging environment first if possible.
Run the following SQL in your JIRA database to synchronize sequence setting for changegroup
update SEQUENCE_VALUE_ITEM SET seq_id = (select max(ID) from changegroup) + 10 where seq_name='ChangeGroup'Restart JIRA.
Was this helpful?