SonarQube 9.9 LTS DB migration issue

Make sure to tell us:

  • What version are you upgrading from?
    9.4
  • System information (Operating system, Java version, Database provider/version)
    Java 17, PostgreSQL 12.8 version
  • What’s the issue you’re facing?
    We are currently running SonarQube Developer Edition – version 9.4 and looking at upgrading to LTS 9.9 version.

However, during our staging upgrade we have encountered an issue with performing manual upgrade of the db.
We get the following error message:

org.sonar.server.platform.db.migration.step.MigrationStepExecutionException: Execution of migration step #6603 'Drop index for 'project_uuid' in 'components'' 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 com.google.common.collect.ImmutableList.forEach(ImmutableList.java:422)

        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:66)

        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.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)

        at java.base/java.lang.Thread.run(Thread.java:833)

Caused by: java.lang.IllegalArgumentException: Index name length can't be more than 30

        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:407)

        at org.sonar.server.platform.db.migration.def.Validations.checkDbIdentifier(Validations.java:215)

        at org.sonar.server.platform.db.migration.def.Validations.validateIndexNameIgnoreCase(Validations.java:194)

        at org.sonar.server.platform.db.migration.step.DropIndexBuilder.build(DropIndexBuilder.java:59)

        at org.sonar.server.platform.db.migration.step.DropIndexChange.lambda$execute$0(DropIndexChange.java:44)

        at java.base/java.util.Optional.ifPresent(Optional.java:178)

        at org.sonar.server.platform.db.migration.step.DropIndexChange.execute(DropIndexChange.java:41)

        at org.sonar.server.platform.db.migration.step.DdlChange.execute(DdlChange.java:45)

        at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:75)

        ... 9 common frames omitted

Seems like its due to the length of our index names. We are running PostgreSQL 12.8 version and based on the available documentation our index names can be up to 63 characters not 30.
After some investigation we found the limit set on your side: sonarqube/Validations.java at 8937c9305a7d8693b5e3771439404238672913b1 · SonarSource/sonarqube · GitHub

Hi,

Welcome to the community, and thanks for this report!

It looks like you’re hitting this:

SONAR-18502 Database migration fails to drop indexes with long generated names

It will be fixed in 10.0. I’m not sure yet whether we’ll back-port it to 9.9 (altho I believe that’s likely).

In the meantime, you’ll want to either restore your DB backup and wait to upgrade, or manually delete the index.

 
HTH,
Ann

1 Like