Upgrade fails: Fail to execute database migration to Sonarqube 3.6.2 - sonarqube

When I would to upgrade from Sonar 3.2 to Sonarqube 3.6.2. the upgrades fails
Int the log file I read the folowing line:
Fail to execute database migration: org.sonar.server.db.migrations.ConvertViolationsToIssues
I use a MSSQL database, I read that someone got exactly the same error when he wanted to upgrade using an Oracle 10g database. I read that this problem will be solved in 3.7. Is this also applying to my problem? When 3.7 will be realeased?
With kind regards.

Your issue indeed looks like 2 other ones listed on stackoverflow:
Sonar-Upgrade from 3.5.1 to 3.6.2 failed
upgrade from sonarqube 3.5.1 to 3.6.2 fails on migration of postgres db
(would need more log to be sure, but I'm almost 100% sure)
So indeed, it will be fixed with SONAR-4542 that will be shipped with SonarQube 3.7, expected in a couple of days from now (around August 9th).

Related

MariaDB clashing with MySQL on Travis-CI

I have a test suite that runs on Travis-CI and requires MariaDB (but it breaks on MySQL). The pre-test scripts call the mysql command, but run commands against MariaDB, as the command is the same for both.
echo "CREATE DATABASE test1" | mysql -u travis
The tests on worker v2.5.0 were passing just fine (https://travis-ci.org/stems/join-monster/jobs/256751422). However, the tests started running on a later version of the worker v2.9.3 and failing without any changes to the code (https://travis-ci.org/stems/join-monster/jobs/260001701). According to the system build information, this new version seems to be installing MySQL in addition to MariaDB. Now when I run my mysql command, it's running against MySQL instead of MariaDB and breaking the build.
I need either:
to go back to a previous version of the worker (can't find any info on how to do this in the Travis docs.
to specify that I want to run commands and connect to MariaDB, NOT MySQL.
to tell Travis to not install MySQL to avoid the clashing
Any of these solutions would be appreciated.
Fixed it by switching the Ubuntu version back to 12 rather than 14, which had become the new default.
In the .travis.yml
dist: precise

SonarQube 4.5.7 to 5.6.5 DB Upgrade failure

I have attempted to upgrade our SonarQube instance from 4.5.7 LTS to 5.6.5 LTS. I followed the provided SonarQube upgrade documentation. After browsing to [sonarserver]:9000/setup and ran the DB Upgrade. The upgrade ran a little over 2 hours and came back with this message:
Upgrade Failed
Database connection cannot be established. Please check database status and JDBC settings.
When viewing the log, I see this error:
2017.02.16 13:18:43 ERROR web[o.s.s.d.m.DatabaseMigrator] Fail to execute database migration: org.sonar.db.version.v50.FeedFileSources
java.lang.IllegalStateException: Error during processing of row: [uuid=AVpHrbhU29-XDi5QdhtN,uuid=AVpHrbk629-XDi5Qdh0r,data=using System;
I have copied the entire db upgrade log here: http://pastebin.com/p9CkYhrU
I also tried to restart SonarQube and attempt the db upgrade again, but it ran for 5-10 mins and reported the same result.
Additional Details:
Current SonarQube: 4.5.7 LTS
New SonarQube: 5.6.5 LTS
DB: MySQL 5.7.17
Operating System: Windows Server 2012 R2
After the unsuccessful upgrade, we reverted back to 4.5.7 successfully.
We also previously upgraded from 4.3.1 to 4.5.7 LTS. During this upgrade, we moved our SonarQube database from MySQL 5.5 to 5.7.17 and then upgraded SonarQube to 4.5.7 LTS. The upgrade step for this ran two hours and completed successfully.
Thank you for any assistance,
-Eddie
UPDATE 2/21/17
I stood up a test instance for this SonarQube upgrade on a different server. I installed MySQL 5.7 and SonarQube 4.5.7 LTS using the same backup data. During the upgrade to SonarQube 5.6.5 LTS, I received the same error as before. So I knew at this point that I could duplicate the error. I decided to look at that error message again and found these a bit further down:
Caused by: java.sql.BatchUpdateException: Packet for query is too large (6371233 > 4194304). You can change this value on the server by setting the max_allowed_packet' variable.
Caused by: com.mysql.jdbc.PacketTooBigException: Packet for query is too large (6371233 > 4194304). You can change this value on the server by setting the `max_allowed_packet` variable.
So I went ahead and edited the max_allowed_packet variable in my.ini. First I changed it from 4M to 8M and received a similar error. Next, I changed the variable to 16M and the upgrade got past the error!
Unfortunately, the DB Upgrade ran for 11 more hours and came back with another error:
2017.02.21 02:48:13 ERROR web[o.s.s.d.m.DatabaseMigrator] Fail to execute database migration: org.sonar.db.version.v564.CleanUsurperRootComponents
java.lang.IllegalStateException: Error during processing of row: [id=62566,uuid=AVpc2I0gt4GsKrhSYYYQ]
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Application was streaming results when the connection failed. Consider raising value of 'net_write_timeout' on the server.
Caused by: java.net.SocketException: Connection reset
I increased the net_read_timeout in mysql from 60 to 1200. set net_write_timeout = 1200; I restarted SonarQube, ran the DB Upgrade again, and got past the error. The upgrade continued running and I received another error:
2017.02.21 09:57:05 ERROR web[o.s.s.d.m.PlatformDatabaseMigration] DB Migration or container restart failed. Process ended with an exception java.lang.IllegalStateException: Fail to load plugin Clirr [clirr]
Caused by: java.lang.NoClassDefFoundError: org/sonar/api/batch/maven/DependsUponMavenPlugin
Caused by: java.lang.ClassNotFoundException: org.sonar.api.batch.maven.DependsUponMavenPlugin
Looks like a plugin error, so I went ahead and looked into that individual plugin. I found some information about the Clirr plugin being deprecated, so I removed it from the Plugins folder, restarted SonarQube, and got hit with another plugin error (different plugin). I got 6 or 7 of these errors and was able to fix them by either removing or replacing the .jar in the Plugins folder with the newer compatible version.
So after fixing the Java plugin, I restarted SonarQube and it started up fine! I am now running SonarQube 5.6.5 LTS on my sandbox server. The next step will be for me to revert back to 4.5.7 LTS and try the upgrade again to be sure I will have a successful production upgrade in the future.

SonarQube :: Current version is too old. Please upgrade to Long Term Support version firstly

I downloaded sonarqube-5.6 and configured the sonar.properties . My mysql version is 5.6 and java version is 1.8. when I start sonar getting error current version is too old , while my sonar is 5.6. Here is error log and sonar.properties
2016.08.03 18:30:13 INFO web[o.s.s.p.ServerImpl] SonarQube Server / 5.6 / 074f3d1169f9688d15af4aff67e7e672cbeed782
2016.08.03 18:30:13 INFO web[o.sonar.db.Database] Create JDBC data source for jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
2016.08.03 18:30:13 ERROR web[o.a.c.c.C.[.[.[/sonar]] Exception sending context initialized event to listener instance of class org.sonar.server.platform.PlatformServletContextListener
org.sonar.api.utils.MessageException: Current version is too old. Please upgrade to Long Term Support version firstly.
Sonar.properties
sonar.jdbc.username=sonar
sonar.jdbc.password=sonar
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEn
coding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
Edit ::
Please note I am using 5.6 version which is latest as per http://docs.sonarqube.org
Link says "you must first upgrade to 4.5.x - I'd recommend 4.5.7 - and then upgrade to 5.3." . I am not getting this , should I install lower version fist and upgrade it 5.6 or what
Version 5.6 can't be upgraded from a version previous to 4.5.x. It seems to be your case, so you should first upgrade to 4.5.x (the latest 4.5.7 is recommended) then upgrade to 5.6.

Why the SonarQube server fails to start with following error message "Database relates to a more recent version"

I'm using Sonar 3.7.2 with JTDS driver for MSSQL database. While starting the sonar in windows gives following error:
2015.06.26 02:54:53 INFO o.s.s.p.ServerImpl SonarQube Server / 3.7.2 / 1feffde9f95897aa000a7123ba54a8c8757b40d8
2015.06.26 02:54:53 INFO o.s.c.p.Database Create JDBC datasource for jdbc:jtds:sqlserver://enbuild03/sonar;SelectMethod=Cursor
2015.06.26 02:54:54 **ERROR o.s.s.p.Platform Database relates to a more recent version of sonar. Please check your settings**.
org.sonar.api.utils.MessageException: Database relates to a more recent version of sonar. Please check your settings.
2015.06.26 02:54:57 INFO jruby.rack jruby 1.6.8 (ruby-1.8.7-p357) (2012-09-18 1772b40) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_43) [Windows Server 2008 R2-amd64-java]
2015.06.26 02:54:57 INFO jruby.rack using a shared (threadsafe!) runtime
I'm stuck here since sonar server not even starting because of the above bold error...
Any help will be appreciated ???
It somehow seems that a newer version of sonar has been run against the db you created. Can you try creating a new DB and see if that works?
If you have run some latest version of sonarqube and then downgraded the sonarqube; you are likely to get this error, if both versions are mapped to same database.
If you view the database there will be some tables in that db, once you wipe out the content of DB and restart sonarqube this error will be gone.

Sonar installation server

I tried installing Sonar as mentioned in the sonar installation tutorial
but am unable to do so due to server error. This is the error I am getting:
"Unable to get version of server http://localhost:9000: Query: http://localhost:9000/api/server/index"
Can someone please help?
Thanks
You can find some posts on my blog about installing/upgrading SonarQube http://qualilogy.com/en/category/sonar/sonar-installation/
I recommend you start with a simple installation without any plugin and then add the plugin and try with Eclispe.
Don't hesitate to ask for further precision (telling where your installation is failing).

Resources