Upgrade of SonarQube from version 6.3 to 6.7.5 fails at step #1641

Upgrade of SonarQube from Version 6.3 (build 19869) to 6.7.5 fails during the setup. Error message:

2018.09.18 13:16:42 ERROR web[][DbMigrations] Executed DB migrations: failure | time=82052ms
2018.09.18 13:16:42 ERROR web[][o.s.s.p.d.m.DatabaseMigrationImpl] DB migration failed | time=82131ms
2018.09.18 13:16:42 ERROR web[][o.s.s.p.d.m.DatabaseMigrationImpl] DB migration ended with an exception
org.sonar.server.platform.db.migration.step.MigrationStepExecutionException: Execution of migration step #1641 'Make components private based on permissions' failed
        at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:79)
        at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:67)
        at java.util.Iterator.forEachRemaining(Iterator.java:116)
        at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
        at java.util.stream.ReferencePipeline$Head.forEachOrdered(ReferencePipeline.java:590)
        at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:52)
        at org.sonar.server.platform.db.migration.engine.MigrationEngineImpl.execute(MigrationEngineImpl.java:50)
        at org.sonar.server.platform.db.migration.DatabaseMigrationImpl.doUpgradeDb(DatabaseMigrationImpl.java:105)
        at org.sonar.server.platform.db.migration.DatabaseMigrationImpl.doDatabaseMigration(DatabaseMigrationImpl.java:80)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: Error during processing of row: [group_id=10140,organization_uuid=AVs4hhbUgzPUrkGu5ofk,id=2428947]
        at org.sonar.server.platform.db.migration.step.SelectImpl.newExceptionWithRowDetails(SelectImpl.java:89)
        at org.sonar.server.platform.db.migration.step.SelectImpl.scroll(SelectImpl.java:81)
        at org.sonar.server.platform.db.migration.step.MassUpdate.execute(MassUpdate.java:91)
        at org.sonar.server.platform.db.migration.version.v64.MakeComponentsPrivateBasedOnPermissions.insertGroupPermissionOfPrivateRootComponent(MakeComponentsPrivateBasedOnPermissions.java:268)
        at org.sonar.server.platform.db.migration.version.v64.MakeComponentsPrivateBasedOnPermissions.execute(MakeComponentsPrivateBasedOnPermissions.java:61)
        at org.sonar.server.platform.db.migration.step.DataChange.execute(DataChange.java:39)
        at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:75)
        ... 11 common frames omitted
Caused by: java.sql.BatchUpdateException: ORA-00001: unique constraint (TSONARQ.SYS_C0010570) violated

        at oracle.jdbc.driver.OraclePreparedStatement.executeLargeBatch(OraclePreparedStatement.java:10032)
        at oracle.jdbc.driver.T4CPreparedStatement.executeLargeBatch(T4CPreparedStatement.java:1364)
        at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:9839)
        at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:234)
        at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
        at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
        at org.sonar.server.platform.db.migration.step.UpsertImpl.addBatch(UpsertImpl.java:42)
        at org.sonar.server.platform.db.migration.step.MassUpdate.callSingleHandler(MassUpdate.java:118)
        at org.sonar.server.platform.db.migration.step.MassUpdate.lambda$execute$0(MassUpdate.java:91)
        at org.sonar.server.platform.db.migration.step.SelectImpl.scroll(SelectImpl.java:78)
        ... 16 common frames omitted

Status message on URL …/setup:

Upgrade Failed
Database connection cannot be established. Please check database status and JDBC settings.

Is there a possibility to solve this error and to continue with the upgrade of the database?

Hello,

Unicity constraint violation during a DB migration does indicate a potential problem with the dataset itself.
Either during this upgrade an instance was connected to the database and changing the dataset, or you are working with a dump done in hot backup mode.
Anyway, you need to check that no instance is connected to the db while performing the migration or to get a dump done in cold backup mode.

Greetings,
Alex.

2 Likes

This was exactly the issue.
Thanks for the support.

1 Like