Bamboo upgrade fails in UpgradeTask 60902 with error "The result set has no current row".
Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.
Summary
Bamboo upgrade process will break in task 60902 when trying to upgrade to version 6.9.0 or higher, showing the message “The result set has no current row”.
Environment
Bamboo running with a version older than 6.9.0.
Diagnosis
During the upgrade, Bamboo will fail with the following error and left in an inconsistent state:
2020-12-10 17:02:10,964 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] --------------------------------------------------------------
2020-12-10 17:02:10,964 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] 60902 : Move TEST CLASSes from jobs to chains (post-bootstrap)
2020-12-10 17:02:10,964 INFO [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] --------------------------------------------------------------
2020-12-10 17:02:10,996 WARN [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [SqlExceptionHelper] SQL Error: 0, SQLState: null
2020-12-10 17:02:10,996 ERROR [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [SqlExceptionHelper] The result set has no current row.
2020-12-10 17:02:11,011 ERROR [18-UpgradeTaskBackgroundThread:pool-40-thread-1] [AbstractUpgradeManager] org.springframework.orm.hibernate5.HibernateJdbcException: JDBC exception on Hibernate data access: SQLException for SQL [n/a]; SQL state [null]; error code [0]; error executing work; nested exception is org.hibernate.exception.GenericJDBCException: error executing work
org.springframework.orm.hibernate5.HibernateJdbcException: JDBC exception on Hibernate data access: SQLException for SQL [n/a]; SQL state [null]; error code [0]; error executing work; nested exception is org.hibernate.exception.GenericJDBCException: error executing work
at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:252)
at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:388)
at org.springframework.orm.hibernate5.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:351)
at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate$1.doInTransaction(BambooTransactionHibernateTemplate.java:36)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate.execute(BambooTransactionHibernateTemplate.java:28)
at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate.execute(BambooTransactionHibernateTemplate.java:33)
at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate.doWork(BambooTransactionHibernateTemplate.java:43)
at com.atlassian.bamboo.upgrade.tasks.v6_9.AbstractMoveJobDataToChainsUpgradeTask.doUpgrade(AbstractMoveJobDataToChainsUpgradeTask.java:37)
at com.atlassian.bamboo.upgrade.tasks.v6_9.UpgradeTask60902MoveTestClassesToChains.doUpgrade(UpgradeTask60902MoveTestClassesToChains.java:28)
at com.atlassian.bamboo.upgrade.AbstractUpgradeManager.runUpgradeTask(AbstractUpgradeManager.java:182)
at com.atlassian.bamboo.upgrade.UpgradeManagerImpl.doUpgrade(UpgradeManagerImpl.java:133)
at com.atlassian.bamboo.upgrade.UpgradeLauncher.lambda$upgradeAndStartBamboo$0(UpgradeLauncher.java:118)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:57)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)
at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)
at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)
at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)
at java.lang.Thread.run(Thread.java:748)
(...)
Cause
In version 6.9.0 Bamboo implemented a change related to how we handle jobs in plan branches at DB level.
This change will include one important DB design change: it will add the column MASTER_JOB_ID in the table TEST_CLASS. The column will also be populated during the execution of the upgrade task. If the test is an orphan test (no jobs associated to it), the task won’t be able to populate that value. This is not permitted by the task, so the task will fail. The entire upgrade process will fail and Bamboo will be in an unusable state.
Ideally, a test should never be orphan. A test can be orphan for many reasons. There has been many bugs that has been addressed already, but the state of the data in the table will still need to be repaired. After 6.9.0, we don’t expect this problem to happen again.
Solution
For the upgrade to work you will need to directly modify data in the database to fix the problem. Please Contact Atlassian Support for guidance on how to fix this, and mention this article for reference.