My upgrade from SQ 7.3 to 7.4 failed at database upgrade phase(triggered by hitting \setup
url) SonarQube log produced the following.
To resolve this, I droppped organization_key
from sonar
DB(which is in SQL Server), completed the upgrade and recreated this index. But sonar application is now logging HTTP 500 errors to browser console:
Failed to load resource: the server responded with a status of 500 ()
The request that causes this log is like:
/api/ce/component?componentKey=<my_project_key>
2018.11.06 10:05:17 INFO web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.ws.WebServiceFilter@662f7274 [pattern=UrlPattern{inclusions=[/api/system/migrate_db.*, ...], exclusions=[/api/properties*, ...]}]
2018.11.06 10:05:17 INFO web[][o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2018.11.06 10:05:19 INFO web[][o.s.s.p.d.m.DatabaseMigrationImpl] Starting DB Migration and container restart
2018.11.06 10:05:19 INFO web[][DbMigrations] Executing DB migrations...
2018.11.06 10:05:19 INFO web[][DbMigrations] #2321 'Increase organization key and name length'...
2018.11.06 10:05:19 ERROR web[][DbMigrations] #2321 'Increase organization key and name length': failure | time=0ms
2018.11.06 10:05:19 ERROR web[][DbMigrations] Executed DB migrations: failure | time=0ms
2018.11.06 10:05:19 ERROR web[][o.s.s.p.d.m.DatabaseMigrationImpl] DB migration failed | time=93ms
2018.11.06 10:05:19 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 #2321 'Increase organization key and name length' 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.lang.Iterable.forEach(Unknown Source)
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.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalStateException: Fail to execute ALTER TABLE organizations ALTER COLUMN kee NVARCHAR (255) NOT NULL
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.v74.IncreaseOrganizationsKeeAndNameLength.execute(IncreaseOrganizationsKeeAndNameLength.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
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The index 'organization_key' is dependent on column 'kee'.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:258)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1535)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:845)
at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:752)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7151)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2478)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:219)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:199)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.execute(SQLServerStatement.java:729)
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
2018.11.06 10:06:10 INFO web[][o.s.p.StopWatcher] Stopping process