ERROR Upgrade from 6.7.6 LTS to version 7.9.1 LTS : ERROR web[][DbMigrations] Executed DB migrations: failure | time=47ms

Hello Everyone,

I am having an issue with the upgrade from 6.7.6 version to 7.9.1 LTS version of SonarQube.
I have tried several workarounds but in vain…
If you could help my guys, i would really appreciate it.
Here are the web logs once i start the service:

> 
>     2019.09.12 19:12:20 INFO  web[][o.s.p.ProcessEntryPoint] Starting web
>     2019.09.12 19:12:22 INFO  web[][o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
>     2019.09.12 19:12:25 INFO  web[][o.e.p.PluginsService] no modules loaded
>     2019.09.12 19:12:25 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.join.ParentJoinPlugin]
>     2019.09.12 19:12:25 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.percolator.PercolatorPlugin]
>     2019.09.12 19:12:25 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
>     2019.09.12 19:12:28 INFO  web[][o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [127.0.0.1:9001]
>     2019.09.12 19:12:28 INFO  web[][o.s.s.p.LogServerVersion] SonarQube Server / 7.9.1.27448 / e0c45c97bb2e45d52629f3422ac91718020f6db9
>     2019.09.12 19:12:28 INFO  web[][o.sonar.db.Database] Create JDBC data source for jdbc:sqlserver://z-acc-forg-svcs-pp-ew1-sql01.database.windows.net:1433;database=z-aas-forg-svcs-pr-euw-sdb00-2019
>     -9-10-12-8;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;
>     2019.09.12 19:12:31 INFO  web[][o.s.s.p.ServerFileSystemImpl] SonarQube home: E:\SonarQube
>     2019.09.12 19:12:31 INFO  web[][o.s.s.u.SystemPasscodeImpl] System authentication by passcode is disabled
>     2019.09.12 19:12:32 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.sonar
>     qube.org/latest/setup/upgrading
>     2019.09.12 19:12:33 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin Azure Active Directory (AAD) Authentication Plug-in for SonarQube / 1.1
>     2019.09.12 19:12:33 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin Git / 1.9.0.1725 / 81017083135ec3ede865956956e0356675e363be
>     2019.09.12 19:12:33 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin Groovy / 1.6 / 612d9fddd92cabac62c19bad70bfd605fa273998
>     2019.09.12 19:12:33 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin JaCoCo / 1.0.2.475 / b79a4724f3a9af1051266b4f8ca0460977295ead
>     2019.09.12 19:12:33 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarC# / 7.16.0.8981 / 86cedcd146affca395d4a3dbff97d11f0a021037
>     2019.09.12 19:12:33 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarGo / 1.1.1.2000 / 40d55921c7a63b67386a053490d17b6723a46cd5
>     2019.09.12 19:12:33 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarHTML / 3.1.0.1615 / 4181edb5eff5605bec82dc0aa15ecd70eaa5857f
>     2019.09.12 19:12:33 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarJS / 5.2.1.7778 / 49f34eaeaad59868d4353d89b1fc5c02bbe51976
>     2019.09.12 19:12:33 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarJava / 5.14.0.18788 / 5722010157fd66ae9f3141184891501b4165f75a
>     2019.09.12 19:12:33 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarKotlin / 1.5.0.315 / 4ff3a145a58f3f84f1b39846a205a129d742e993
>     2019.09.12 19:12:33 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarPHP / 3.2.0.4868 / ec66bd5f8490677eb0ebae82aa17c2a5d9c0e5e7
>     2019.09.12 19:12:33 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarPython / 1.14.1.3143 / eed7b315b6116fe462a19c771013bf3891c92a97
>     2019.09.12 19:12:33 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarRuby / 1.5.0.315 / 4ff3a145a58f3f84f1b39846a205a129d742e993
>     2019.09.12 19:12:33 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarScala / 1.5.0.315 / 4ff3a145a58f3f84f1b39846a205a129d742e993
>     2019.09.12 19:12:33 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarTS / 1.9.0.3766 / 4a4080b78001a78d758d1d0fa0190fb9496b6f57
>     2019.09.12 19:12:33 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarVB / 7.15.0.8572 / e0ad49e38a28a8fc333ba746fc998e48678f6a8b
>     2019.09.12 19:12:33 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarXML / 2.0.1.2020 / c5b84004face582d56f110e24c29bf9c6a679e69
>     2019.09.12 19:12:33 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin Svn / 1.9.0.1295 / 942e075773975354e32691a60bfd968065703e04
>     2019.09.12 19:12:42 INFO  web[][o.s.s.p.d.m.c.MssqlCharsetHandler] Verify that database collation is case-sensitive and accent-sensitive
>     2019.09.12 19:12:43 INFO  web[][o.s.s.p.Platform] Database needs to be migrated. Please refer to https://docs.sonarqube.org/latest/setup/upgrading
>     2019.09.12 19:12:43 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.ws.WebServiceFilter@c8c01d1 [pattern=UrlPattern{inclusions=[/api/system/migrate_db.*, .
>     ..], exclusions=[/api/properties*, ...]}]
>     2019.09.12 19:12:43 INFO  web[][o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 80
2019.09.12 19:14:02 INFO  web[][o.s.s.p.d.m.DatabaseMigrationImpl] Starting DB Migration and container restart
2019.09.12 19:14:03 INFO  web[][DbMigrations] Executing DB migrations...
2019.09.12 19:14:03 INFO  web[][DbMigrations] #1937 'Drop index on project_measures.person_id'...
2019.09.12 19:14:03 ERROR web[][DbMigrations] #1937 'Drop index on project_measures.person_id': failure | time=47ms
2019.09.12 19:14:03 ERROR web[][DbMigrations] Executed DB migrations: failure | time=47ms
2019.09.12 19:14:03 ERROR web[][o.s.s.p.d.m.DatabaseMigrationImpl] DB migration failed | time=280ms
2019.09.12 19:14:03 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 #1937 'Drop index on project_measures.person_id' 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.base/java.lang.Iterable.forEach(Iterable.java:75)
        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: Fail to execute DROP INDEX measures_person ON project_measures
        at org.sonar.server.platform.db.migration.step.DdlChange$Context.execute(DdlChange.java:97)
        at org.sonar.server.platform.db.migration.step.DdlChange$Context.execute(DdlChange.java:77)
        at org.sonar.server.platform.db.migration.step.DdlChange$Context.execute(DdlChange.java:117)
        at org.sonar.server.platform.db.migration.version.v70.DropIndexOnPersonMeasures.execute(DropIndexOnPersonMeasures.java:35)
        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: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot drop the index 'project_measures.measures_person', because it does not exist or you do not have permission.
        at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:262)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1621)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:868)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:768)
        at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7194)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2935)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:248)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:223)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.execute(SQLServerStatement.java:744)
        at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:175)
        at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:175)
        at org.sonar.server.platform.db.migration.step.DdlChange$Context.execute(DdlChange.java:82)
        ... 14 common frames omitted

It starts from here

2019.09.12 19:14:03 ERROR web[DbMigrations] #1937 ‘Drop index on project_measures.person_id’: failure | time=47ms

Thank you for your time.

Sincerely,
Abdel

Hi Abdel

Welcome to the community!

Here’s your problem:

Can you check your DB to see if the index exists? If is does, it seems that we’re looking at a permissions problem.

 
Ann

Thank you, very glad to join you.

I have checked the database, there is no index with that name…

Abdelmajid

Hello,

I created a ticket to improve how SQ handles dropping an index which does not exist: SONAR-12464.

In the meantime, the workaround is to manually create an index with this name on that table.

1 Like

I have already tried this, but does not work, i am wondering where can i edit the sql db migration framework, so i can ignore this drop index statement when failed

1 Like

Anyone have any idea how to workaround this?

1 Like

Hey sonar experts…
I am upgrading from 7.6 to 7.9.x LTS

I have the same issue. The dba in my team tried to create the index missing but it doesn’t work, after the creation of the index we have issue with constraints … We need to upgarde asap. Any news on this??
I have this issue:

2020.02.17 10:21:17 ERROR web[o.s.s.p.d.m.DatabaseMigrationImpl] DB migration failed | time=262ms
2020.02.17 10:21:17 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 #2606 ‘Drop DATA_TYPE column from FILE_SOURCES table’ failed

Caused by: java.lang.IllegalStateException: Fail to execute DROP INDEX file_sources_uuid_type ON file_sources

Caused by: java.lang.IllegalStateException: Fail to execute DROP INDEX file_sources_uuid_type ON file_sources

1 Like

Hello,

I still have the same issue, but found a way to workaround it, by creating the missing components everytime, it took me a while but it works.
Otherwise, have you tried upgrading to the last version 7.9.2 ?

Sincerely,
Abdel

Thank you Abdel, did you had issues with constraints? did you remove them?

After we created that index we had these type of issues:
2020.02.14 12:41:57 INFO web[DbMigrations] #2606 ‘Drop DATA_TYPE column from FILE_SOURCES table’…

2020.02.14 12:41:57 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 #2606 ‘Drop DATA_TYPE column from FILE_SOURCES table’ faile

​Caused by: java.lang.IllegalStateException: Fail to execute ALTER TABLE file_sources DROP COLUMN data_type

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The object ‘DF__file_sour__data___74A4331B’ is dependent on column ‘data_type’.