Bamboo won't build after a new commit
Asked by David_Mills:

I have upgraded Bamboo and Bitbucket from 3.9.1 and 3.8.0 (Stash) to 3.13.0.1 and 4.9.1 respectively. Then set up application links and a build projct and plan. It happily builds (with errors due to the build file) until I commit a change. Then the build won't start. Bamboo displays the error:

```
System Error DetailsBuild Pulse - wmi 17?:?Errors getting changes for PUL-WMI-17?(org.springframework.orm.hibernate4.HibernateJdbcException : JDBC exception on Hibernate data access: SQLException for SQL [insert into COMMIT_FILES (COMMIT_ID, COMMIT_FILE_NAME, COMMIT_FILE_REIVISION) values (?, ?, ?)]; SQL state [HY000]; error code [1364]; could not execute batch; nested exception is org.hibernate.exception.GenericJDBCException: could not execute batch)?org.springframework.orm.hibernate4.HibernateJdbcException: JDBC exception on Hibernate data access: SQLException for SQL [insert into COMMIT_FILES (COMMIT_ID, COMMIT_FILE_NAME, COMMIT_FILE_REIVISION) values (?, ?, ?)]; SQL state [HY000]; error code [1364]; could not execute batch; nested exception is org.hibernate.exception.GenericJDBCException: could not execute batch	at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:168)	at org.springframework.orm.hibernate4.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:685)	at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:567)	at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:757)	at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:726)	at sun.reflect.GeneratedMethodAccessor146.invoke(Unknown Source)	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)	at java.lang.reflect.Method.invoke(Method.java:498)	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201)	at com.sun.proxy.$Proxy32.commit(Unknown Source)	at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:478)	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:272)	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)	at com.sun.proxy.$Proxy70.updateResultSummaryWithBuildChanges(Unknown Source)	at com.atlassian.bamboo.chains.ChainExecutionManagerImpl$1.getChainState(ChainExecutionManagerImpl.java:249)	at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.tryStartChainState(ChainExecutionManagerImpl.java:330)	at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.delayedStart(ChainExecutionManagerImpl.java:228)	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)	at java.lang.reflect.Method.invoke(Method.java:498)	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)	at com.sun.proxy.$Proxy133.delayedStart(Unknown Source)	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)	at java.lang.reflect.Method.invoke(Method.java:498)	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201)	at com.sun.proxy.$Proxy133.delayedStart(Unknown Source)	at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1$1.lambda$call$47(PlanExecutionManagerImpl.java:414)	at com.atlassian.bamboo.util.CacheAwareness$3.call(CacheAwareness.java:159)	at com.atlassian.bamboo.util.CacheAwareness$3.call(CacheAwareness.java:155)	at com.atlassian.bamboo.util.CacheAwareness.withValuesOlderThanTimestampReloaded(CacheAwareness.java:188)	at com.atlassian.bamboo.util.CacheAwareness.withValuesOlderThanTimestampReloaded(CacheAwareness.java:154)	at com.atlassian.bamboo.util.CacheAwareness.withValuesOlderThanTimestampReloaded(CacheAwareness.java:219)	at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1$1.call(PlanExecutionManagerImpl.java:413)	at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1$1.call(PlanExecutionManagerImpl.java:404)	at io.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:293)	at com.atlassian.bamboo.plan.PlanExecutionLockServiceImpl.lock(PlanExecutionLockServiceImpl.java:85)	at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.doWithProcessLock(PlanExecutionManagerImpl.java:784)	at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.access$400(PlanExecutionManagerImpl.java:130)	at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1.run(PlanExecutionManagerImpl.java:398)	at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:51)	at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:31)	at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:20)	at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:52)	at java.lang.Thread.run(Thread.java:745)Caused by: org.hibernate.exception.GenericJDBCException: could not execute batch	at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54)	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124)	at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.performExecution(BatchingBatch.java:122)	at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.doExecuteBatch(BatchingBatch.java:101)	at org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.execute(AbstractBatchImpl.java:161)	at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.getBatch(JdbcCoordinatorImpl.java:196)	at org.hibernate.persister.collection.AbstractCollectionPersister.recreate(AbstractCollectionPersister.java:1230)	at org.hibernate.persister.collection.OneToManyPersister.recreate(OneToManyPersister.java:183)	at org.hibernate.action.internal.CollectionRecreateAction.execute(CollectionRecreateAction.java:58)	at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:395)	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:387)	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:309)	at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:349)	at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:56)	at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1195)	at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:404)	at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101)	at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175)	at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:559)	... 53 moreCaused by: java.sql.BatchUpdateException: Field 'LIST_POSITION' doesn't have a default value	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)	at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)	at com.mysql.jdbc.Util.getInstance(Util.java:387)	at com.mysql.jdbc.SQLError.createBatchUpdateException(SQLError.java:1161)	at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1773)	at com.mysql.jdbc.PreparedStatement.executeBatchInternal(PreparedStatement.java:1257)	at com.mysql.jdbc.StatementImpl.executeBatch(StatementImpl.java:958)	at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:2544)	at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.performExecution(BatchingBatch.java:113)	... 69 moreCaused by: java.sql.SQLException: Field 'LIST_POSITION' doesn't have a default value	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:963)	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966)	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902)	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2526)	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2673)	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2549)	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)	at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2073)	at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1751)	... 73 more
```

I can't find any solutions on the net. Does anyone have any ideas?


Answers:
author: Alexey Chystoprudov
body: During upgrade Bamboo should drop column COMMIT_FILES.LIST_POSITION, there should be logs during upgrade:

```
[INFO] Dropping primary key on COMMIT_FILES[INFO] The primary key constraint on COMMIT_FILES has been dropped.
```

In case of any problems there should be ERROR or WARN log messages which doesn't prevent Bamboo from upgrade continue.

Please check logs for any WARN and ERRORS and if it's the only warning, drop this column manually

comments: author: PBT Admin
body: I'm just getting to look at this now. I tried dropping the field, but it won't let me as it is part of the primary key.

I'll look into changing that.

But this leads me to wonder, if this part of the upgrade didn't occur, what else didn't.

Is it possible to force the upgrade scripts to run again?

What other course of action can I take?

Thanks,

David


author: PBT Admin
body: I tried

```
mysql> alter table `commit_files` drop primary key, add primary key(`COMMIT_ID`);
```

but got the error

```
ERROR 1062 (23000): Duplicate entry '3047425' for key 'PRIMARY'
```

There are 23 rows in the table, but only 2 distinct commit_ids. Can I truncate the table, or will that cause other issues?


Tags: bamboo-administration