Upgrade 9.5 to 9.8 / 9.9

Hello,

I’m trying to upgrade our SonarQube version to 9.8 but am running into database errors.

Error:
Fail to execute ALTER TABLE users DROP CONSTRAINT DF_users_sonarlint_1D7B6025

‘DF_users_sonarlint_1D7B6025’ is not a constraint

Things I tried:
multiple upgrades: 9.6 > 9.7 > 9.8 (in this order)
manually altering the table via SSMS

The only constraint in the constraint folder is: DF_users_active_6C6E1476.

Welcome :slight_smile:

you should update straight to Sonarqube 9.9.0 LTS + latest.
If your Sonarqube server runs with MSSQL, Sonarqube 9.9.0 has two fixes
https://sonarsource.atlassian.net/browse/SONAR-17833
https://sonarsource.atlassian.net/browse/SONAR-17839

Gilbert

1 Like

I still get the same constraint error when trying to upgrade to 9.9.0.

Hi,

We’re not wild about log screenshots here. They can be hard to read, among other reasons. Does your screenshot show the entire stacktrace? If not, can you copy/paste the log text starting from… about where your screenshot starts, at least through the end of the stacktrace?

Could you also provide what DB engine you’re using (Oracle, Postgres, …) and - if you remember - what your first version of SonarQube was?

 
Ann

access.2023-02-10.log (648.8 KB)
access.2023-02-12.log (4.0 MB)
access.2023-02-13.log (4.0 MB)
access.2023-02-14.log (4.0 MB)

Logs part 1

access.log (1.8 MB)
es.log (4.3 KB)
sonar.log (2.8 KB)
SonarServiceWrapper.wrapper.log (64 Bytes)
web.log (11.0 KB)

Logs part 2

From the looks of it, version 8.4.2 was the first one.

Thanks. I’ve flagged this for the team.

 
Ann

Hi there, @pxiong,

Thank you for your question. We are investigating the issue, and would like to ask that you execute the following query on your DB:

SELECT d.name FROM sys.tables t 
JOIN sys.default_constraints d ON d.parent_object_id = t.object_id
JOIN sys.columns c ON c.object_id = t.object_id AND c.column_id = d.parent_column_id
WHERE  t.name = 'users' AND c.name in ('sonarlint_ad_seen')

Please send the response back to us and we will take it from there.

Regards

The result of the query:

DF__users__sonarlint__1D7B6025

Capture

Hello,

Do you have any updates on this issue?

Hi again, @pxiong,

This is very strange. Are you sure that the DB user had permissions to ALTER table? We tried reproducing the issue and the migrations worked for us. If confirmed, could you try running the same ALTER TABLE sql manually in your DB using the same DB user as SonarQube, and then restart SonarQube?

Regards

@pxiong Hi again.

Were you able to figure the problem out?

Thanks for the tips but that did not fix the issue.

Am I able to install 9.9 and import the existing database?

What I’m referring to is installing 9.9 on a new server and hooking into the existing database.

This will not help, as you will still have an issue with the database.

Perhaps check the fragmentation of the indexes in your database, as you might need to reorganize them.

1 Like