Upgrade to SQ 8.4 Enterprise fails with MigrationStepExecutionException

Hi,

just tried to upgrade our Sonarqube Enterprise test instance running with MSSQL 17.7
from 8.2.0.32929 to 8.4.0.35506, but it fails with a MigrationStepExecution

2020.07.06 13:02:38 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 #3609 ‘Drop index on ‘group_id’ column of ‘GROUPS_USERS’ table’ failed

Didn’t notice anything new WRT the database requirements in the upgrade notes.
see web.log (11.3 KB) attached

Gilbert

Hi, could you tell us if the index groups_users.groups_users_unique do exist in this test database? From the error message (in german :cry: ), i understand that it can be either the index does not exist, or the user lack authorization to drop it.

Hi,

yes the index exists, was also uppercase in former versions and upgrade had no problems.

sq_84_db

Are additional db permissions necessary for Sonarqube 8.4 ?
Found no indication in the upgrade notes.

Just talked to our db admin, our user is already ddl-admin which means
create, alter, drop any object.

Thanks for the details. We will try to reproduce the issue, which looks specific to MSSQL.

Hi Gilbert,
Thanks for reporting the problem with the migration.

I’ve created a ticket: https://jira.sonarsource.com/browse/SONAR-13594
For unknown reasons but probably due to a past migration, there’s an index with the name in upper case, which is unexpected.
With what version did you originally install SonarQube (migrating since then)?

We will release a bug fix in the upcoming days.

Hi @dmeneses,

we’ve started with 5.6 back in 2016 … updating from then on.
Our production instance runs on Sonarqube 7.9.1, test with 8.2
Both dbs have the index in uppercase = GROUPS_USERS_UNIQUE
Notice, the update to 8.2 in test started with a copy from the productive Sonarqube db.
7.9.1 already has the index in uppercase, but the update from 7.9.1 to 8.2 did work without any problems using the same MSSQL version and db permissions.

Gilbert

Hi @dmeneses
We are also facing the same issue.
image

We have upgraded version to version 8.1.0.31237 > 8.2.0.32929 > 8.3.1.34397

I changed the GROUPS_USERS_UNIQUE index to lower case and it fixes that issue but then hit another issue
“Execution of migration step #3647 ‘Make ‘user_uuid’ not-null for ‘ORGANIZATION_MEMBERS’’ failed
Fail to execute ALTER TABLE organization_members ALTER COLUMN user_uuid NVARCHAR (255) NOT NULL”

Scott

Hi Scott,
Could you please post the full log of the error (with the stack trace) of that second issue?

@dmeneses as request:

2020.07.08 06:45:23 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 21 rows processed (0 items/sec)
2020.07.08 06:45:23 INFO  web[][DbMigrations] #3646 'Populate 'user_uuid' for 'ORGANIZATION_MEMBERS'': success | time=46ms
2020.07.08 06:45:23 INFO  web[][DbMigrations] #3647 'Make 'user_uuid' not-null for 'ORGANIZATION_MEMBERS''...
2020.07.08 06:45:23 ERROR web[][DbMigrations] #3647 'Make 'user_uuid' not-null for 'ORGANIZATION_MEMBERS'': failure | time=65ms
2020.07.08 06:45:23 ERROR web[][DbMigrations] Executed DB migrations: failure | time=1120ms
2020.07.08 06:45:23 ERROR web[][o.s.s.p.d.m.DatabaseMigrationImpl] DB migration failed | time=1348ms
2020.07.08 06:45:23 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 #3647 'Make 'user_uuid' not-null for 'ORGANIZATION_MEMBERS'' 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: Fail to execute ALTER TABLE organization_members ALTER COLUMN user_uuid NVARCHAR (255) NOT NULL
	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.version.v84.users.fk.util.MakeUserUuidColumnNotNullable.execute(MakeUserUuidColumnNotNullable.java:47)
	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 insert the value NULL into column 'user_uuid', table 'SonarQube.dbo.organization_members'; column does not allow nulls. UPDATE fails.
	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:262)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1624)
	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:2979)
	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:194)
	at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:194)
	at org.sonar.server.platform.db.migration.step.DdlChange$ContextImpl.execute(DdlChange.java:91)
	... 14 common frames omitted

Thanks!

A post was split to a new topic: How easy is it to upgrade to 8.4?

Hi @dmeneses ,

i confirm the MSSQL related error is fixed with Sonarqube 8.4.1
Had no problems with db migration from 8.1 Enterprise.

Gilbert

2 Likes

Good the hear that, thanks for letting us know.

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