12

We are trying to upgrade to lastest sonarqube 5.5. We have mariadb 10.1 (latest) and since now we had no problems with sonarqube.

Now, with the upgrade, sonarqube will not boot. It says:

Unsupported mysql version: 5.5. Minimal supported version is 5.6.

Is there any trick we can use to make "sonar think" we are using mysql 5.6?

CSchulz
  • 10,882
  • 11
  • 60
  • 114
cocorossello
  • 1,289
  • 1
  • 17
  • 30

3 Answers3

9

You could change the MINIMAL_SUPPORTED_DB_VERSIONS member in the Sonarqube's class https://github.com/SonarSource/sonarqube/blob/master/sonar-db/src/main/java/org/sonar/db/DatabaseChecker.java

  private static final Map<String, Version> MINIMAL_SUPPORTED_DB_VERSIONS = ImmutableMap.of(
    // MsSQL 2008 is 10.x
    // MsSQL 2012 is 11.x
    // MsSQL 2014 is 12.x
    // https://support.microsoft.com/en-us/kb/321185
    MsSql.ID, Version.create(10, 0, 0),
    MySql.ID, Version.create(5, 6, 0),
    Oracle.ID, Version.create(11, 0, 0),
    PostgreSql.ID, Version.create(8, 0, 0)
  );

And build the project again, but If they have that requirement it's possible that after the change not everything is going to work fine.

Eduardo Yáñez Parareda
  • 9,126
  • 4
  • 37
  • 50
  • Yes, I understand the risk. – cocorossello May 04 '16 at 13:16
  • 1
    Obviously removal of support of mysql < 5.6 was done on purpose. The checks are not here to annoy you but to ensure a correct and stable behavior at runtime. Your hack must not be used in production environment. – Simon Brandhof May 05 '16 at 12:57
  • 1
    What I don't understand is what this answer is downvoted. – Eduardo Yáñez Parareda May 05 '16 at 18:04
  • 1
    I downvoted as you recommend to remove a sanity check. That may lead to potential side-effects at runtime. It's not a responsible advice, neither for users, neither for community supporting these users. – Simon Brandhof May 09 '16 at 11:22
  • 4
    I did't recommend anything, I gave an aswer to a question, and warned that doing that Sonarqube might not work fine. – Eduardo Yáñez Parareda May 09 '16 at 12:30
  • 1
    We are using this as a test, we are a small team and starting with sonarqube analysis. If we like it we will implement it properly, with mysql, but meanwhile (1 or 2 months) we would like to use our database. We can afford the risk of losing everything – cocorossello May 11 '16 at 07:48
  • So you should instead test the version 5.4, which is Mysql 5.5 compliant (for testings is is enough), or use the embedded db - Sonarqube is delivered with an H2 databased in it. Hacking the code, is ugly, error prone and will most likely gives you strange errors at runtime. If the check is here, it is for a good reason. If you hack and have problems, you will blame Sonarqube but the root of the problem would be you - not them. – spi May 17 '16 at 08:01
  • 10
    MariaDB 10 is MySQL 5.6 compatible, so the negative arguments about removing a sanity check are invalid. The sanity check itself should be more intelligent, especially with MariaDB replacing MySQL as the default MySQL implementation on many distributions, e.g., the mentioned CentOS 7. – Patrick Bergner Jun 10 '16 at 12:44
  • 3
    @SimonBrandhof-SonarSource, could you please comment on the fact that MariaDB 10 is MySQL 5.6 compatible? Do you have any reason to believe that it's going to cause problems? It looks more like a bug in the sonar detection code... I mean I would understand "we did not test it with MariaDB and therefore cannot provide any guarantees" but "The checks are not here to annoy you.." sounds a bit harsh given the declared MariaDB compatibility. – Andrew Savinykh Jul 05 '16 at 05:08
  • 1
    @PatrickBergner this is not completely true, MariaDB 10.x and MySQL 5.6 and beyond are not fully compatible to each other anymore. Take the different GTID and parallel replication implementations for example. – Hartmut Holzgraefe Jul 05 '16 at 10:21
  • @SimonBrandhof-SonarSource could you elaborate on the MySQL 5.6 specific features being used? – Hartmut Holzgraefe Jul 05 '16 at 10:24
  • @HartmutHolzgraefe the reasons are described at https://groups.google.com/forum/#!msg/sonarqube/GmbtZ_qf1ME/vCHk4sZVAwAJ – Simon Brandhof Jul 05 '16 at 13:26
  • This answer is outdated, since the code in v7 has changed – geistLich Mar 03 '18 at 14:33
  • The question is for version 5.5, not version 7. – Eduardo Yáñez Parareda Mar 04 '18 at 16:08
0

here is a bsdiff file.

you can Patch it with:

bspatch sonar-db-5.6.jar sonar-db-5.6.jar.new sonar-db-5.6.jar.patch

Replace it and it works!

https://drive.google.com/file/d/0B1EExMdpLmiLR1JmVFQ3ZTVPTlU/view?usp=sharing

Michel
  • 21
  • 1
  • 4
    It seems it is a bug in MariaDB. The jdbc driver seems to report the major number on connection.getMetaData().getDatabaseMinorVersion(), thus it is 5.5 instead of 5.6. Also, when performing getDatabaseProductVersion(), it returns here: 5.5.5-10.1.17-MariaDB – Bertl Sep 07 '16 at 14:30
0

MariaDB is not supported by SonarQube - still in v7. Please see this here:

SonarQube Requirements

The Solution to run SonarQube in combination with XAMPP is to change the database from MariaDB to MySQL. Here you'll find the steps for changing it:

https://gist.github.com/odan/c799417460470c3776ffa8adce57eece

geistLich
  • 183
  • 1
  • 7