Sonarqube 8.8 New bug display is empty

Hello,

Is it possible to simply delete the offending Project in SonarQube and rescan your project?

Brian

Hi Brian,
Thanks for the follow up.
Any way to backup / restore all the project settings / customizations?
Backup restore all the historical data?

Thanks.

It looks like the corruption is deep.

If I run the query reindex database sonar;
I get

ERROR:  could not create unique index "live_measures_component"
DETAIL:  Key (component_uuid, metric_uuid)=(AXDLKbtE7qwnL6TvLD3_, 109) is duplicated.
CONTEXT:  parallel worker
SQL state: 23505

but the issue is each time I run, I get another duplicate

ERROR:  could not create unique index "live_measures_component"
DETAIL:  Key (component_uuid, metric_uuid)=(AXeM8_rzsR3Qon7t5km_, 88) is duplicated.
SQL state: 23505

ERROR:  could not create unique index "live_measures_component"
DETAIL:  Key (component_uuid, metric_uuid)=(AW-p2J4SglcKdeahchz_, 1) is duplicated.
SQL state: 23505

ERROR:  could not create unique index "live_measures_component"
DETAIL:  Key (component_uuid, metric_uuid)=(AWkbgzwDFqwmFHLr0C2-, 101) is duplicated.
SQL state: 23505

and if I query

select component_uuid, count(*) from live_measures
group by uuid order by count desc

I don’t see any duplicates, all counts are 1
Where are all these duplicates coming from and why on each run it is a different pair?

Hello,

Unfortunately, I can’t determine why this data corruption exists (the are several possibilities) and suggesting edits of the database runs the risk of further corruption.

My only recommendation is to delete this offending project (and any Portfolios or Applications that contain it) and recreate them. Unless you have a database backup that you are certain is free of this corruption, there is no way to restore your configuration. All of your existing issues will be re-detected in the first scan of the project.

I don’t know if this applies to your case, but you should avoid any direct manipulation of the database and make sure multiple instances of SonarQube are not connected to the same DB. This is been shown to cause data corruption when attempted by other users.

Please let me know if this corrects your issue.

Brian

Thanks Brian,

We only have one instance of Sonar Server, besides it is dockerized with local PostgreSQL, hence no possibility of multiple instances corrupting the database.

In any case we have many backups, however we don’t know if any are corruption free.
Also, what guarantees us that the corruption is only in this project, and more importantly, what guarantees us that there is not be any future corruptions.

Data integrity should be on top of Sonar’s list yes the ticket is not assigned.

We will try to delete this project and reconfigure it, but it will take time, we have to coordinate with the development team to make sure we capture all the customization that was applied to the project.

Which brings up another critical point, the settings db should be decoupled from runtime db, this way one can flush the runtime db without losing the settings and one can backup the settings independent of the runtime, I can’t fathom how with known corruption history this is not part of the core Sonar architecture.

1 Like

Hello,

Note that most analysis parameters can be set in a project configuration file or via the scanner command line rather than the UI. This can be:

  • pom.xml (Maven projects)
  • gradle.properties (Gradle projects)
  • .csproj (.NET projects)
  • sonar-project.properties (other project types)

I’ll suggest you move your scanning parameters to these locations if you prefer not to store in the DB.

Cheers,

Brian

2 Likes