8

We are currently running a production server at version 5.1.2 which we are planning to upgrade.

Tests have shown that upgrading to 5.3 works as expected.

However, upgrading from 5.1.2 -> 5.4 or 5.1.2 -> 5.3 -> 5.4 results in all quality profiles from the 5.1.2 instance becoming empty - no rules assigned at all.

Worse, backing up the rules and attempting to restore them fails silently.

Has anyone else experienced this? Is there a work-around?

Thanks in advance.

G. Ann - SonarSource Team
  • 22,346
  • 4
  • 40
  • 76
playtime222
  • 99
  • 1
  • 8
  • Do you have the relevant language plugins installed on the 5.4 server? When you go to the list of Rules, can you find any of the rules that should be in your profile? – G. Ann - SonarSource Team Mar 17 '16 at 14:25
  • All the rules exist. All of the plugins were updated to a version compatible with 5.4 or else the database upgrade failed. This affected views, sqale and ldap. After upgrade, all modules were updated through the Update Centre. – playtime222 Mar 17 '16 at 14:32
  • Were the language plugins present _at the time of_ the database upgrade? – G. Ann - SonarSource Team Mar 17 '16 at 16:00
  • I had the exact same issue. I tried resetting the quality profiles, but not all rules were restored (around 70% of them) and also the project dashboards were showing inconsistent numbers of issues. To fix that issue I had to delete the history of the project and re-initialize them. The worst thing is that I've seen no issues during the upgrade. I expect to be shown when something fails during an upgrade. Any leads on this? – anthonymonori Mar 18 '16 at 11:30
  • All the plugins from the original instance were copied over prior to attempting the db upgrade. 3 were upgraded as above. I get the same result with using C# 4.2 and 5.0. The Java, Objective-C and other languages all have empty quality profiles after upgrade. – playtime222 Mar 18 '16 at 12:33

2 Answers2

14

The update instructions in the Administration view (System Upgrades) differ from the instructions here: Upgrading

I would change the first instructions as follows (in cursive text the changed/added lines) and I'd try to keep the Upgrading instructions in sync.

  1. Copy the list of installed plugins and stop your old SonarQube server.
  2. Download the new SonarQube version and start it on an empty DB (the bundled H2 DB for instance).
  3. Install (from the update center) the plugins you want.
  4. Install your custom plugins (if any).
  5. Update the conf/sonar.properties file to use the relevant configurations from your old instance, including the connection information for your production DB.
  6. Stop your new SonarQube server.
  7. Remove the following folders from the new SonarQube server: data, temp
  8. Start the new SonarQube instance: you're done!
Stephan LV
  • 165
  • 1
  • 11
  • Hey! How did you know that you have to delete the `data` and `temp` folders?! This step is nowhere described (not in the System Upgrades view not in the Upgrading instructions documentation), but it really solved the problem I had! Thanks a lot! – dokaspar Mar 06 '17 at 09:20
  • Kudos to the others who commented before me. I "just" collected available information and wrote the correct upgrading instructions. – Stephan LV Mar 06 '17 at 10:31
  • Somebody should mark this as the correct answer. I don’t quite know why this is not in the official docs, and why it keeps happening (in my case, while going from 6.1 to 6.3) – Michael Piefel Mar 20 '17 at 12:06
  • 1
    Just to reaffirm this answer, I did an upgrade today from 5.6.4 to 6.7.4 and ran into the same issue. I did the upgrade three times before finally finding this post. Deleting the `data` and `temp` directories worked great for me. I'm not sure why I'm not seeing this on the [official documentation](https://docs.sonarqube.org/display/SONAR/Upgrading), so I [posted](https://community.sonarsource.com/t/upgrading-sonarqube-causes-all-projects-and-rules-to-disappear-with-solution/1532?u=mike12489) on their forum asking if this is correct and (if so) if they can update the documentation for us. – Mike Hill Aug 02 '18 at 20:41
6

I had the same problem today migrating from 4.5.6 to 5.4. I managed to bypass the problem by reverting back to 4.5.6 and then migrating in the old fashion, i.e ignoring the new upgrade instructions.

Environment was Windows10/Postgresql4.3

Further investigation showed that I had missed a step in the new instructions, namely the deletion of the data/es directory.

I have run the migration a number of times and if I run up the default H2 database in order to verify and update plugins but forget to delete the data/es directory prior to switching to postgresql, then the quality profiles end up with zero rules, but if I follow the instructions correctly then the profiles are migrated correctly.

Please check your procedures against http://docs.sonarqube.org/display/SONAR/Upgrading

Hope this helps

Scimitar
  • 61
  • 1
  • Would it work to shut down an incorrectly upgraded instance, *then* remove the **data/es** directory and start it up? – Alix Apr 27 '16 at 20:33
  • 1
    Yes. I was able to shutdown my upgraded instance and then backup and remove the data dir. The rules quality profiles were restored – Sam Nunnally Jun 23 '16 at 16:46