Sonarqube Upgrade 8.6

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    7.9.2, latest scanner
  • what are you trying to achieve
    Simply upgrade Sonarqube to 8.6
  • what have you tried so far to achieve this
    What is the recommended path to upgrade from SQ 7.9.2 to SQ 8.6. We ask because we tried to upgrade directly to 8.6 and that didn’t work, then tried to upgrade through the available versions (where are 8.0 and 8.1?) and we are still having problems. Without going into the details, what is the recommended upgrade procedure?
    Any help you could provide would be greatly appreciated.

Hi @pjasonbutler ,

have a look at our upgrade guide :slight_smile:

in general always have a backup and version hop from your current installation to the latest LTS release (7.9.5) and then to 8.6.
it would be great if you could share some insights if you are facing issues with this approach

Hi Tobias,
Thanks for your quick response. We wanted to know if we were doing anything wrong before going into the problem.
We upgraded from 7.9.2 to 7.9.5 LTS and then directly to 8.6, but had problems. Since we were having problems, we took baby steps up to 8.6 through each version. At 8.3, we cannot get the Postgres 10 database to migrate after navigating to /setup. The logs have the following error:

Execution of migration step #3306 ‘Migrate ‘resource_id’ to ‘component_uuid’ in ‘group_roles’’ failed

Caused by: java.lang.IllegalStateException: Error during processing of row: [gp_id=674,c_uuid=AWyLLQs7_4psv2HNkFql]

Caused by: java.sql.BatchUpdateException: Batch entry 28 update group_roles set component_uuid = ‘AWiFcPW53lqvnDiSXuW6’ where id = 50 was aborted: ERROR: unexpected data beyond EOF in block 15 of relation base/16385/32986

We got a similar EOF, but in project_measures when we went to 8.6 directly.
We’ve made sure our OS is patched. We have increased the RAM for Postgres 10 instance as well as the max_wal_size.
We are incredibly stuck. Any help you could provide to mitigate this error would be appreciated.

Hey, how many rows your group_roles table contains?

Hi,
There are 1,599 rows in group_roles. I counted them in Sonarqube version 8.2 and Postgresql version 10.15.
Thanks

Okay so this one is rather small, so maybe your Postgresql memory is already full with the join between group_roles and components, and can’t perform the update.

What if you try to execute directly the update for this group_roles yourself?

(execute this when the migration fail at step #3306):
update group_roles set component_uuid = 'AWiFcPW53lqvnDiSXuW6' where id = 50

If this succeeds, try to restart SonarQube to resume the migration. If it keeps failing at another line, you can try to execute this query, which is equivalent to the migration step #3306:

update group_roles gr
set component_uuid = c.uuid
from components c
where gr.resource_id = c.id and gr.component_uuid is null

If that fails as well, well at least you have an easy reproducer to try to tune your PostgreSQL memory settings.

Let us know if this help.

Thank you so much. The first command did allow us to upgrade to 8.3. What we would ultimately like to do though is upgrade to 8.6. Version 8.3 is when it started failing, so we were hoping that after we got to that version, we would be able to get to 8.6, however that is not the case. We are getting the same error that we were initially, which is a very similar error to the one we received going to 8.3, however, this one had issues with project_measures and uuid(s). I was able to get past the first error in project_measures by adjusting the first command you sent, but then it just erred out on another line in project_measures. The second command that you had recommended may work, but I am not sure how to adjust that for project_measures. If you could provide that adjusted command, it would be greatly appreciated. Also, I doubt we should have to do this manually all the time, so I would like to know what you think the underlying problem might be, so that we may address it. Your help is greatly appreciated.

What is the size of your components table? On which migration are you failing now?

Thank you for your quick response. The size of our components table is 11MB. This is the error we are getting:

Execution of migration step #3433 'Populate 'uuid' column for 'PROJECT_MEASURES'' failed

Caused by: java.lang.IllegalStateException: Error during processing of row: [id=6344]

java.sql.BatchUpdateException: Batch entry 120 update project_measures set uuid = 'AXeCCDCkF9UU7xMNUXT9' where id = 601549 was aborted: ERROR: unexpected data beyond EOF in block 223 of relation base/16385/2526

I can fix one row, and then it fails on another. I have fixed 3 or 4 rows so far and I am still getting the error.

Thanks for your help.

There is definitely something wrong on your PostgreSQL database side. Either with the configuration, the disk, or something else.

Could you give some details on how you operate this PostgreSQL instance?

We are running our database in Openshift. It has a minimum and maximum of 16 gigs RAM, 2 to 4 CPUs. I have tuned the database, using an online tool, so it should be optimized for the environment it is in. We are using a Persistent Volume Claim to store the data. Also, if there is a command similar to the one that you gave us to update the entire group_roles table that would work for the project_measures table, I would appreciate it if you could post that.
As always, your help is greatly appreciated.

I’m sorry but there is no such query for this specific migration. It’s about populating the table with UUID created by SonarQube, you can’t do that from a native SQL query.

That’s an interesting point to dig into. What’s the underlying real storage? Could you try an experiment with another storage?