Constraint violation in MSSQL when creating review
Platform Notice: Data Center Only - This article only applies to Atlassian products 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
Summary
Symptoms
Fisheye/Crucible is connected to MSSQL.
Failed to create review for certain commits.
The following appears in the atlassian-fisheye-<date>.log
:
1
2
3
4
2014-03-28 05:43:26,267 WARN [btpool0-66 ] org.hibernate.util.JDBCExceptionReporter JDBCExceptionReporter-logExceptions - SQL Error: 2627, SQLState: 23000
2014-03-28 05:43:26,268 ERROR [btpool0-66 ] org.hibernate.util.JDBCExceptionReporter JDBCExceptionReporter-logExceptions - Violation of UNIQUE KEY constraint 'UQ__cru_revi__21F7C44C19DFD96B'. Cannot insert duplicate key in object 'dbo.cru_revision'. The duplicate key value is (REPONAME, <pathID>, <COMMIT_HASH>).
2014-03-28 05:43:26,268 ERROR [btpool0-66 ] org.hibernate.event.def.AbstractFlushingEventListener AbstractFlushingEventListener-performExecutions - Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: could not insert: [com.cenqua.crucible.model.CrucibleRevision]
Diagnosis
Run the following SQL query in Fisheye/Crucible database:
1
Select TABLE_NAME, COLUMN_NAME, COLLATION_NAME From INFORMATION_SCHEMA.COLUMNS
Check if there is any collation name with "CI_AS
" (CI means Case Insensitive).
Cause
Fisheye/Crucible only works with Case Sensitive collation set as stated in Migrating to SQL Server.
Solution
Resolution
Create a new MSSQL database with
Latin1_General_CS_AS
collation set.Migrate Fisheye/Crucible to the new database at
Administration > System Settings > Database
.
Was this helpful?