Update from Developer Edition 8.1 to 8.3 failed due to a DB migration error

Description:

I try to update Sonarqube from 8.1 to 8.3 (tried to 8.2 also). But when i do, everythings works fine until i try to migrate the database ([…]/setup).

  • Versions used: SonarQube Developer Edition 8.1
  • JDBC-Database is used with an user which has priviliges to do everything in the database
  • Error is shown in the web.log
2020.06.04 06:24:16 ERROR web[][DbMigrations] #3210 'Add index on ALM_slug': failure | time=4ms
 2020.06.04 06:24:16 ERROR web[][DbMigrations] Executed DB migrations: failure | time=163372ms
 2020.06.04 06:24:16 ERROR web[][o.s.s.p.d.m.DatabaseMigrationImpl] DB migration failed | time=163449ms
 2020.06.04 06:24:16 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 #3210 'Add index on ALM_slug' 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:405)
         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:68)
         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:1128)
         at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
         at java.base/java.lang.Thread.run(Thread.java:834)
 Caused by: java.lang.IllegalStateException: Can not check that table project_alm_settings exists
         at org.sonar.db.DatabaseUtils.wrapSqlException(DatabaseUtils.java:352)
         at org.sonar.db.DatabaseUtils.doIndexExists(DatabaseUtils.java:331)
         at org.sonar.db.DatabaseUtils.indexExists(DatabaseUtils.java:314)
         at org.sonar.server.platform.db.migration.version.v82.AddIndexOnSlugOfProjectAlmSettings.indexExists(AddIndexOnSlugOfProjectAlmSettings.java:61)
         at org.sonar.server.platform.db.migration.version.v82.AddIndexOnSlugOfProjectAlmSettings.execute(AddIndexOnSlugOfProjectAlmSettings.java:42)
         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
 Caused by: java.sql.SQLException: Ungültige Argumente in Aufruf
         at oracle.jdbc.OracleDatabaseMetaData.getIndexInfo(OracleDatabaseMetaData.java:3731)
         at org.apache.commons.dbcp2.DelegatingDatabaseMetaData.getIndexInfo(DelegatingDatabaseMetaData.java:419)
         at org.apache.commons.dbcp2.DelegatingDatabaseMetaData.getIndexInfo(DelegatingDatabaseMetaData.java:419)
         at org.sonar.db.DatabaseUtils.doIndexExists(DatabaseUtils.java:322)
         ... 14 common frames omitted

Any kind of ideas how we can solve this problem?

Hi,

Welcome to the community!

Was there any more to the stacktrace?

 
Ann

Hello,

thank you for the fast answer. No i just have this message in the sonar.log

2020.05.26 07:53:45 WARN app[startup]
################################################################################
The database must be manually upgraded. Please backup the database and browse /setup. For more information: https://docs.sonarqube.org/latest/setup/upgrading
################################################################################

But i think this warn is quite normal.After doing the /setup i see just the stacktrace above in the web.log.

I can give you some lines above the stacktrace in the web.log:

2020.05.26 07:53:40 INFO  web[][o.s.p.ProcessEntryPoint] Starting web
2020.05.26 07:53:41 INFO  web[][o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2020.05.26 07:53:42 INFO  web[][o.s.c.e.CoreExtensionsLoader] Loaded core extensions: developer-edition, developer-scanner, developer-server, license
2020.05.26 07:53:42 INFO  web[][o.e.p.PluginsService] no modules loaded
2020.05.26 07:53:42 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.join.ParentJoinPlugin]
2020.05.26 07:53:42 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.percolator.PercolatorPlugin]
2020.05.26 07:53:42 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2020.05.26 07:53:43 INFO  web[][o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [127.0.0.1:9101]
2020.05.26 07:53:43 INFO  web[][o.s.s.p.LogServerVersion] SonarQube Server / 8.3.1.34397 / 054c18b025be038b6343115894bf3ade0508f1e9
2020.05.26 07:53:43 INFO  web[][o.sonar.db.Database] Create JDBC data source for jdbc:oracle:thin:@db-xxxxx-xxxxxxxxxxxx:1523:xxxxxx
2020.05.26 07:53:45 INFO  web[][o.s.s.p.ServerFileSystemImpl] SonarQube home: /opt/sonar-web/sonarqube-8.3.1.34397
2020.05.26 07:53:45 INFO  web[][o.s.s.u.SystemPasscodeImpl] System authentication by passcode is disabled
2020.05.26 07:53:45 WARN  web[][o.s.s.p.DatabaseServerCompatibility] The database must be manually upgraded. Please backup the database and browse /setup. For more information: https://docs.sonarqube.org/latest/setup/upgrading
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin C# Code Quality and Security / 8.6.1.17183 / e9f4299031df68d8c4be6ba670fd4c0395eebf76
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin CFamily Code Quality and Security / 6.9.0.17076 / 05f2b0d1d57eb98a9efed7be184627ae5c962cac
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin Git / 1.11.1.2008 / 204dc9b2cc33ec6b780303f926234eed26aea67d
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin JaCoCo / 1.1.0.898 / f65b288e6c2888393bd7fb72ad7ac1425f88eebf
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin Java Code Quality and Security / 6.3.0.21585 / ecf8f9f571691771e6789b8e59ff5e6b4ef36ad8
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SQL language plugin / 1.0.5
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarABAP / 3.8.0.2034 / 2904652c6ef4863eaace62c40fec0512724430e4
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarCSS / 1.2.0.1325 / 8dc9fe17b6230c20715d3b4cb34e0b6d02151afd
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarFlex / 2.5.1.1831 / a0c44437f6abb0feec76edd073f91fec64db2a6c
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarGo / 1.6.0.719 / edcc6a9e42fcdd30bb6f84a779c6cd7009ec72fd
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarHTML / 3.2.0.2082 / 997a51b39c4d0a5399c73a8fb729030a69eb392b
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarJS / 6.2.0.12043 / 8b9c1eb83d6ecfd2eda2cc3798e593900b6735fd
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarKotlin / 1.5.0.315 / 4ff3a145a58f3f84f1b39846a205a129d742e993
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarPHP / 3.3.0.5166 / 88e11dffb965aeef9d5bdd6d8413f394d35fecba
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarPLSQL / 3.4.1.2576 / a27e6384088454d7160dd39ea5ba54a9929c15f4
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarPython / 2.8.0.6204 / 5600d1ed780882d2362bedb3604dbad7ea63eb27
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarRuby / 1.5.0.315 / 4ff3a145a58f3f84f1b39846a205a129d742e993
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarScala / 1.5.0.315 / 4ff3a145a58f3f84f1b39846a205a129d742e993
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarSwift / 4.2.2.77 / ad3e52bad0857bc89efe0503a420fac67d809398
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarTS / 2.1.0.4359 / 268ba9581b700c4fb2bc194d4069d283da915213
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarTSQL / 1.4.0.3334 / 7b4dc9eeb6301765e09583a3d570b5941223e0b4
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarXML / 2.0.1.2020 / c5b84004face582d56f110e24c29bf9c6a679e69
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin Svn / 1.9.0.1295 / 942e075773975354e32691a60bfd968065703e04
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin VB.NET Code Quality and Security / 8.6.1.17183 / e9f4299031df68d8c4be6ba670fd4c0395eebf76
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin Vulnerability Analysis / 8.3.0.1825 / 69e80e00e81ec01c571ecc4e589fc6a229285052
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin Vulnerability Rules for C# / 8.3.0.1825 / 69e80e00e81ec01c571ecc4e589fc6a229285052
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin Vulnerability Rules for Java / 8.3.0.1825 / 69e80e00e81ec01c571ecc4e589fc6a229285052
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin Vulnerability Rules for PHP / 8.3.0.1825 / 69e80e00e81ec01c571ecc4e589fc6a229285052
2020.05.26 07:53:46 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin Vulnerability Rules for Python / 8.3.0.1825 / 69e80e00e81ec01c571ecc4e589fc6a229285052
2020.05.26 07:53:47 INFO  web[][o.s.s.p.Platform] Database needs to be migrated. Please refer to https://docs.sonarqube.org/latest/setup/upgrading
2020.05.26 07:53:47 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.platform.web.WebServiceFilter@112f4937 [pattern=UrlPattern{inclusions=[/api/system/migrate_db.*, ...], exclusions=[/api/components/update_key, ...]}]
2020.05.26 07:53:47 INFO  web[][o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9100
2020.05.26 07:54:06 INFO  web[][o.s.s.p.d.m.DatabaseMigrationImpl] Starting DB Migration and container restart
2020.05.26 07:54:06 INFO  web[][DbMigrations] Executing DB migrations...
2020.05.26 07:54:06 INFO  web[][DbMigrations] #3200 'Drop 'In Review' Security Hotspots status '...
2020.05.26 07:54:06 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 0 rows processed (0 items/sec)
2020.05.26 07:54:06 INFO  web[][DbMigrations] #3200 'Drop 'In Review' Security Hotspots status ': success | time=54ms
2020.05.26 07:54:06 INFO  web[][DbMigrations] #3201 'Migrate Manual Vulnerabilities to Security Hotspots '...
2020.05.26 07:54:06 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 0 rows processed (0 items/sec)
2020.05.26 07:54:06 INFO  web[][DbMigrations] #3201 'Migrate Manual Vulnerabilities to Security Hotspots ': success | time=15ms
2020.05.26 07:54:06 INFO  web[][DbMigrations] #3202 'Remove 'newsbox.dismiss.hotspots' user property'...
2020.05.26 07:54:06 INFO  web[][DbMigrations] #3202 'Remove 'newsbox.dismiss.hotspots' user property': success | time=10ms
2020.05.26 07:54:06 INFO  web[][DbMigrations] #3203 'Ensure Security Hotspots have status TO_REVIEW'...
2020.05.26 07:54:06 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 0 rows processed (0 items/sec)
2020.05.26 07:54:06 INFO  web[][DbMigrations] #3203 'Ensure Security Hotspots have status TO_REVIEW': success | time=14ms
2020.05.26 07:54:06 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 0 rows processed (0 items/sec)
2020.05.26 07:54:06 INFO  web[][DbMigrations] #3203 'Ensure Security Hotspots have status TO_REVIEW': success | time=14ms
2020.05.26 07:54:06 INFO  web[][DbMigrations] #3204 'Rename table 'PROJECTS' to 'COMPONENTS''...
2020.05.26 07:54:07 INFO  web[][DbMigrations] #3204 'Rename table 'PROJECTS' to 'COMPONENTS'': success | time=197ms
2020.05.26 07:54:07 INFO  web[][DbMigrations] #3205 'Add PROJECTS table'...
2020.05.26 07:54:07 INFO  web[][DbMigrations] #3205 'Add PROJECTS table': success | time=53ms
2020.05.26 07:54:07 INFO  web[][DbMigrations] #3206 'Populate PROJECTS table'...
2020.05.26 07:54:07 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 23 projects processed (0 items/sec)
2020.05.26 07:54:07 INFO  web[][DbMigrations] #3206 'Populate PROJECTS table': success | time=368ms
2020.05.26 07:54:07 INFO  web[][DbMigrations] #3207 'Drop 'TAGS' column from COMPONENTS table'...
2020.05.26 07:54:07 INFO  web[][DbMigrations] #3207 'Drop 'TAGS' column from COMPONENTS table': success | time=156ms
2020.05.26 07:54:07 INFO  web[][DbMigrations] #3208 'Remove old Security Review Rating measures'...
2020.05.26 07:54:08 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 833 rows processed (13 items/sec)
2020.05.26 07:54:14 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 833 rows processed (13 items/sec)
2020.05.26 07:54:14 INFO  web[][DbMigrations] #3208 'Remove old Security Review Rating measures': success | time=6665ms
2020.05.26 07:54:14 INFO  web[][DbMigrations] #3209 'Create ALM_PATS table'...
2020.05.26 07:54:14 INFO  web[][DbMigrations] #3209 'Create ALM_PATS table': success | time=25ms
2020.05.26 07:54:14 INFO  web[][DbMigrations] #3210 'Add index on ALM_slug'...
2020.05.26 07:54:14 ERROR web[][DbMigrations] #3210 'Add index on ALM_slug': failure | time=2ms
2020.05.26 07:54:14 ERROR web[][DbMigrations] Executed DB migrations: failure | time=7565ms
2020.05.26 07:54:14 ERROR web[][o.s.s.p.d.m.DatabaseMigrationImpl] DB migration failed | time=7614ms
2020.05.26 07:54:14 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 #3210 'Add index on ALM_slug' 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:405)
        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:68)
        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:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalStateException: Can not check that table project_alm_settings exists
        at org.sonar.db.DatabaseUtils.wrapSqlException(DatabaseUtils.java:352)
        at org.sonar.db.DatabaseUtils.doIndexExists(DatabaseUtils.java:331)
        at org.sonar.db.DatabaseUtils.indexExists(DatabaseUtils.java:314)
        at org.sonar.server.platform.db.migration.version.v82.AddIndexOnSlugOfProjectAlmSettings.indexExists(AddIndexOnSlugOfProjectAlmSettings.java:61)
        at org.sonar.server.platform.db.migration.version.v82.AddIndexOnSlugOfProjectAlmSettings.execute(AddIndexOnSlugOfProjectAlmSettings.java:42)
        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
Caused by: java.sql.SQLException: Ungültige Argumente in Aufruf
        at oracle.jdbc.OracleDatabaseMetaData.getIndexInfo(OracleDatabaseMetaData.java:3731)
        at org.apache.commons.dbcp2.DelegatingDatabaseMetaData.getIndexInfo(DelegatingDatabaseMetaData.java:419)
        at org.apache.commons.dbcp2.DelegatingDatabaseMetaData.getIndexInfo(DelegatingDatabaseMetaData.java:419)
        at org.sonar.db.DatabaseUtils.doIndexExists(DatabaseUtils.java:322)
        ... 14 common frames omitted
2020.05.26 08:17:51 INFO  web[][o.s.p.ProcessEntryPoint] Gracefully stopping process

Good morning,

anyone a hint or idea?

Regards, Cavit

Hello, is there an index on the alm_slug column of the project_alm_settings table already ? (index name should be project_alm_settings_slug)

Hello, thank you for the answer.
No, there is no index named project_alm_settings_slug in the column alm_slug in the table project_alm_settings

Should i add it?

That could be a workaround yes, since the migration is failing for an unknown reason. The index should be non-unique, on the alm_slug column. Having the index named project_alm_settings_slug is mandatory for SonarQube to operate properly.

Once the index successfully added, you need to “cheat” the migration system to bypass the failing step:

INSERT INTO schema_migrations
('version')
VALUES('3210');

You can then restart, and the migration will resume at the next step. Of course, I highly recommend you to backup your database before trying this.

1 Like

Thank you! The workaround worked for our dev/test-environment. In the next days i will backup our production-db and try to updated it too.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.