-
Bug
-
Resolution: Fixed
-
Low
-
7.0.6, 8.0.0
-
None
-
1
-
Severity 2 - Major
-
Issue Summary
When trying an import, the process will fail with a constraint violation exception.
Steps to Reproduce
This error has been observed when:
- An Bamboo export is done with a MSSQL DB. Size of build results is more than 10000 elements
- Build results use Warnings parser task and have referenced warnings.
- The import is done with a Postgres DB.
Expected Results
Import successful.
Actual Results
The below exception is thrown in atlassian-bamboo.log:
2021-08-09 17:10:31,163 ERROR [http-nio-8085-exec-7] [SqlExceptionHelper] Referential integrity constraint violation: "FK_GP357KL07X691DI4I2XN0C8HI: PUBLIC.BUILDRESULTSUMMARY FOREIGN KEY(STAGERESULT_ID) REFERENCES PUBLIC.CHAIN_STAGE_RESULT(STAGERESULT_ID) (18942327)"; SQL statement:
insert into BUILDRESULTSUMMARY (CREATED_DATE, BUILD_KEY, PLAN_NAME, BUILD_NUMBER, BUILD_STATE, LIFE_CYCLE_STATE, BUILD_DATE, BUILD_CANCELLED_DATE, BUILD_COMPLETED_DATE, DURATION, PROCESSING_DURATION, TIME_TO_FIX, TRIGGER_REASON, DELTA_STATE, BUILD_AGENT_ID, STAGERESULT_ID, RESTART_COUNT, QUEUE_TIME, MARKED_FOR_DELETION, ONCE_OFF, CUSTOM_BUILD, REBUILD, LOG_SIZE, VARIABLE_CONTEXT_BASELINE_ID, FORMAT_VERSION, FAILURE_TEST_COUNT, SUCCESS_TEST_COUNT, TOTAL_TEST_COUNT, BROKEN_TEST_COUNT, EXISTING_TEST_COUNT, FIXED_TEST_COUNT, TOTAL_TEST_DURATION, QUARANTINED_TEST_COUNT, SKIPPED_TEST_COUNT, VCS_UPDATE_TIME, CHAIN_RESULT, BUILD_TYPE, BUILDRESULTSUMMARY_ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'BUILD', ?) [23506-196]
2021-08-09 17:10:31,165 WARN [http-nio-8085-exec-7] [BambooStAXMappingHelperAbstractImpl] Exception during processing warnings.warning #1
javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute batch
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:188)
at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1460)
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1440)
at com.atlassian.bamboo.migration.BambooStAXListImportStrategy$3$1.doInTransaction(BambooStAXListImportStrategy.java:105)
at com.atlassian.bamboo.migration.BambooStAXListImportStrategy$3$1.doInTransaction(BambooStAXListImportStrategy.java:89)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
at com.atlassian.bamboo.migration.BambooStAXListImportStrategy$3.importListItems(BambooStAXListImportStrategy.java:89)
at com.atlassian.bamboo.migration.BambooStAXListImportStrategy.importListXml(BambooStAXListImportStrategy.java:223)
at com.atlassian.bamboo.migration.BambooStAXMappingListHelperAbstractImpl.importListXml(BambooStAXMappingListHelperAbstractImpl.java:190)
(...)
Caused by: org.hibernate.exception.ConstraintViolationException: could not execute batch
at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:112)
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.performExecution(BatchingBatch.java:128)
at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.doExecuteBatch(BatchingBatch.java:104)
at org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.execute(AbstractBatchImpl.java:147)
at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.getBatch(JdbcCoordinatorImpl.java:201)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3145)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3686)
at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:90)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:596)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:470)
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:356)
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)
at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1454)
... 233 more
Workaround
Currently there is no known workaround for this behavior. A workaround will be added here when available