Commit indexing on 5.x releases sometimes fails with a set of errors like this:
2017-08-18 07:21:24,320 ERROR [commit-indexing:thread-2] o.h.e.jdbc.spi.SqlExceptionHelper Batch entry 16 insert into cs_repo_membership (cs_id, repository_id) values ('069a0fa3e1565c66083ec7b4d8684920f31817cc', 10661) was aborted: ERROR: insert or update on table "cs_repo_membership" violates foreign key constraint "fk_repo_membership_changeset" Detail: Key (cs_id)=(069a0fa3e1565c66083ec7b4d8684920f31817cc) is not present in table "changeset". Call getNextException to see other errors in the batch. 2017-08-18 07:21:24,320 ERROR [commit-indexing:thread-2] o.h.e.jdbc.spi.SqlExceptionHelper ERROR: insert or update on table "cs_repo_membership" violates foreign key constraint "fk_repo_membership_changeset" Detail: Key (cs_id)=(069a0fa3e1565c66083ec7b4d8684920f31817cc) is not present in table "changeset". 2017-08-18 07:21:24,321 ERROR [commit-indexing:thread-2] o.h.i.ExceptionMapperStandardImpl HHH000346: Error during managed flush [org.hibernate.exception.ConstraintViolationException: could not execute batch]
This appears to be related to the upgrade to Hibernate 5.2.10, which has had some bugs reported related to how inserts and updates are ordered. While those bugs have been fixed, a Hibernate 5.2.11 release including them has not yet been finalized. Bitbucket Server should work around the ordering problems by using Session.flush() to force the correct order.
Potentially related:
[BSERV-10062] Commit indexing sometimes fails trying to insert repository memberships
Workflow | Original: Stash Workflow - Restricted [ 2424065 ] | New: JAC Bug Workflow v3 [ 3137335 ] |
Symptom Severity | Original: Major [ 14431 ] | New: Severity 2 - Major [ 15831 ] |
Fix Version/s | New: 5.6.0 [ 75407 ] | |
Fix Version/s | New: 5.5.1 [ 75406 ] |
Remote Link |
New:
This issue links to "Bitbucket Server › Master DAO › |
Remote Link |
New:
This issue links to "Bitbucket Server › Pull Request Build with Coverage › |
Remote Link |
New:
This issue links to "Bitbucket Server › Pull Request Build › |
Fix Version/s | New: 5.4.1 [ 75092 ] |
Fix Version/s | New: 5.3.3 [ 75128 ] |
Fix Version/s | New: 5.2.5 [ 75125 ] |
Fix Version/s | New: 5.1.7 [ 75122 ] |