Reputation: 908
I'm trying to updgrade Sonarqube from 4.5 to 4.5.1 on Ubuntu 14.04 64 bits. The package manager serves the new version and it installed apparently without any problem. However, when I try to access the web UI it takes me to the page where it says I need to upgrade the database. So I go to the my_sonar_server/setup page and click upgrade. After few seconds, the following message appears
Exclamation Impossible to upgrade database
Migration failed: An error has occurred, all later migrations canceled: ActiveRecord::ConnectionNotEstablished: no connection available: alter table snapshot_sources modify data longtext . Please check logs.
The sonar.log has the following exception
2014.11.10 10:04:38 INFO web[DbMigration] MysqlMediumtextToLongtext: migrating
2014.11.10 10:04:42 ERROR web[o.s.s.ui.JRubyFacade] Fail to upgrade database An error has occurred, all later migrations canceled:
ActiveRecord::ConnectionNotEstablished: no connection available: alter table snapshot_sources modify data longtext /opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract_adapter.rb:227:in
log' /opt/sonar/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/adapter.rb:183:in
execute' /opt/sonar/web/WEB-INF/db/migrate/600_mysql_mediumtext_to_longtext.rb:42:inapply' /opt/sonar/web/WEB-INF/db/migrate/600_mysql_mediumtext_to_longtext.rb:30:in
up' org/jruby/RubyKernel.java:2223:insend' /opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:282:in
migrate' jar:file:/opt/sonar/lib/server/jruby-complete-1.7.9.jar!/META-INF/jruby.home/lib/ruby/1.8/benchmark.rb:293:inmeasure' /opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:282:in
migrate' org/jruby/RubyKernel.java:2227:insend' /opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:365:in
migrate' /opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:491:inmigrate' org/jruby/RubyProc.java:290:in
call' org/jruby/RubyProc.java:224:incall' /opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:567:in
ddl_transaction' /opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:490:inmigrate' org/jruby/RubyArray.java:1613:in
each' /opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:477:inmigrate' /opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:401:in
up' /opt/sonar/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:383:inmigrate' /opt/sonar/web/WEB-INF/lib/database_version.rb:62:in
upgrade_and_start' /opt/sonar/web/WEB-INF/app/models/database_migration_manager.rb:109:instart_migration' org/jruby/RubyProc.java:290:in
call' org/jruby/RubyProc.java:228:in `call'
Any help here would be much appreciated!
Thanks
Upvotes: 1
Views: 438
Reputation: 908
The problem was that one of tables (snapshot_sources
) got corrupted at some point, presumably when we cloned our production server to have a test server.
When I tried to access a particular row on that particular table either through phpmyadmin or the command line, the database connection was lost (mysqld
process was restarting itself). I investigated the root of the problem (by digging /var/log/mysql/error.log
) along with our IT team, and reached the aforementioned conclusion.
So, the migration of the database was being interrupted because of this, due to the fact that the migration was trying to alter snapshot_sources
table to convert the data
field from mediumtext
to longtext
The way I fixed it was:
truncate
sentences to empty the tables before importing)Hope this helps someone else or at least it is a sort of heads up for Sonar team.
Upvotes: 3
Reputation: 26843
The log is explicit enough: ConnectionNotEstablished
. This means that you haven't configured your SonarQube instance correctly to access the database...
Upvotes: -1