DB migration ended with an exception - From 9.7.1.6 to 9.9 LTS

I’m using JDK 20 and I’m upgrading from Sonar 9.7.1.6 to 9.9. Why can’t I start it?

Starting SonarQube...
2023.07.28 16:03:49 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory C:\Sonar\sonarqube-9.9.1.69595\temp
2023.07.28 16:03:49 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:3617]
2023.07.28 16:03:50 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[ELASTICSEARCH] from [C:\Sonar\sonarqube-9.9.1.69595\elasticsearch]: C:\Sonar\Java\jdk-20\bin\java -XX:+UseG1GC -Djava.io.tmpdir=C:\Sonar\sonarqube-9.9.1.69595\temp -XX:ErrorFile=C:\Sonar\sonarqube-9.9.1.69595\logs\es_hs_err_pid%p.log -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djna.tmpdir=C:\Sonar\sonarqube-9.9.1.69595\temp -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dio.netty.allocator.numDirectArenas=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j2.formatMsgNoLookups=true -Djava.locale.providers=COMPAT -Dcom.redhat.fips=false -Des.enforce.bootstrap.checks=true -Xmx2G -Xms2G -XX:+HeapDumpOnOutOfMemoryError -Delasticsearch -Des.path.home=C:\Sonar\sonarqube-9.9.1.69595\elasticsearch -Des.path.conf=C:\Sonar\sonarqube-9.9.1.69595\temp\conf\es -cp lib/* org.elasticsearch.bootstrap.Elasticsearch
2023.07.28 16:03:50 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
Exception in thread "main" java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
        at java.base/java.lang.System.setSecurityManager(System.java:425)
        at org.elasticsearch.bootstrap.Security.setSecurityManager(Security.java:99)
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:70)
2023.07.28 16:03:53 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 1
2023.07.28 16:03:53 INFO  app[][o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2023.07.28 16:03:53 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped

I downgraded the opnejdk from jdk-20 to jdk-17.0.2 and now I’m getting

2023.07.28 16:35:51 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2023.07.28 16:36:20 INFO  app[][o.s.a.SchedulerImpl] Process[es] is up
2023.07.28 16:36:20 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[WEB_SERVER] from [C:\Sonar\sonarqube-9.9.1.69595]: C:\Sonar\Java\jdk-17.0.2\bin\java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=C:\Sonar\sonarqube-9.9.1.69595\temp -XX:-OmitStackTraceInFastThrow --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.management/sun.management=ALL-UNNAMED --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED -Dcom.redhat.fips=false -Xmx1G -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.*|[::1] -cp ./lib/sonar-application-9.9.1.69595.jar;C:\Sonar\sonarqube-9.9.1.69595\lib\jdbc\mssql\mssql-jdbc-11.2.2.jre17.jar org.sonar.server.app.WebServer C:\Sonar\sonarqube-9.9.1.69595\temp\sq-process5734201106974505400properties
WARNING: A terminally deprecated method in java.lang.System has been called
WARNING: System::setSecurityManager has been called by org.sonar.process.PluginSecurityManager (file:/C:/Sonar/sonarqube-9.9.1.69595/lib/sonar-application-9.9.1.69595.jar)
WARNING: Please consider reporting this to the maintainers of org.sonar.process.PluginSecurityManager
WARNING: System::setSecurityManager will be removed in a future release
2023.07.28 16:36:37 INFO  app[][o.s.a.SchedulerImpl] Process[Web Server] is stopped
2023.07.28 16:36:37 INFO  app[][o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2023.07.28 16:36:37 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped

my es.log file doesnt show anything out of the ordinary but my web.log file is showing this message:

2023.07.28 16:36:21 INFO  web[][o.s.p.ProcessEntryPoint] Starting Web Server
2023.07.28 16:36:27 INFO  web[][o.s.s.p.LogServerVersion] SonarQube Server / 9.9.1.69595 / ab53fa3b811b30e6c4391e9f77edce9019d84480
2023.07.28 16:36:27 INFO  web[][o.sonar.db.Database] Create JDBC data source for jdbc:sqlserver://"Ihaveherethehostname";integratedSecurity=true;encrypt=false;trustServerCertificate=true;databaseName="Ihaveherethedbname"
2023.07.28 16:36:28 INFO  web[][c.z.h.HikariDataSource] HikariPool-1 - Starting...
2023.07.28 16:36:36 ERROR web[][c.z.h.p.HikariPool] HikariPool-1 - Exception during pool initialization.
com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication.

After manually replacing the dll for mssql-jdbc_auth-11.2.2.x64.dll I am now getting the message:
2023.07.28 17:18:26 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

After manually upgrading the DB by going to /setup we are facing the following error:

2023.07.28 17:27:20 ERROR web[][DbMigrations] #6703 'Drop project measure variation column': failure | time=418ms
2023.07.28 17:27:20 ERROR web[][DbMigrations] Executed DB migrations: failure | time=298007ms
2023.07.28 17:27:20 ERROR web[][o.s.s.p.d.m.DatabaseMigrationImpl] DB migration failed | time=298083ms
2023.07.28 17:27:20 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 #6703 'Drop project measure variation column' 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.IllegalStateException: Fail to execute ALTER TABLE project_measures DROP COLUMN variation_value_1
	at org.sonar.server.platform.db.migration.step.DdlChange$ContextImpl.execute(DdlChange.java:106)
	at org.sonar.server.platform.db.migration.step.DdlChange$ContextImpl.execute(DdlChange.java:86)
	at org.sonar.server.platform.db.migration.step.DdlChange$ContextImpl.execute(DdlChange.java:128)
	at org.sonar.server.platform.db.migration.step.DropColumnChange.execute(DropColumnChange.java:49)
	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: The index 'IDX_NC_project_measures_component_uuid_metric_uuid' is dependent on column 'variation_value_1'.
	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:265)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1676)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:907)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:802)
	at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7627)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:3916)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:268)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:242)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.execute(SQLServerStatement.java:775)
	at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:94)
	at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java)
	at org.sonar.server.platform.db.migration.step.DdlChange$ContextImpl.execute(DdlChange.java:91)
	... 14 common frames omitted

Can somebody give a hint on how to resolve this?

I checked this thread DB migration for upgrade to 8.9.7 LTS fails: Make uuid column not nullable for PROJECT_MEASURES failed - #4 by ganncamp as it’s very similar but the account that is performing the migration has dbo in the default schema so I don’t see an immediate solution.
image

Hi,

Welcome to the community!

I don’t find that index in the SonarQube code base. So I’m guessing it got created manually on your side…? Can you drop it and try again?

 
Ann

Thank you for the help.
After dropping it and restarting the service, it was possible to finish the upgrade with success.

DROP INDEX dbo.project_measures.IDX_NC_project_measures_component_uuid_metric_uuid;

1 Like

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