声纳4.4升级失败

时间:2014-08-29 10:11:41

标签: upgrade sonarqube

尝试从4.3.2升级到Sonar 4.4时,db迁移失败,并带有以下

以前有人见过这个吗? 快速查看jira问题,但没有发现任何相关内容。

使用MS SQLServer 2008

...     2014.08.29 11:58:12 INFO [DbMigration]
    2014.08.29 11:58:12 INFO [DbMigration] == InverseRuleKeyIndex:迁移================================= ===========     2014.08.29 11:58:12 INFO [DbMigration] - remove_index(:rules,{:name =>“rules_plugin_key_and_name”})     2014.08.29 11:58:12 INFO [DbMigration] - 删除重复的规则     2014.08.29 11:58:12 INFO [DbMigration] - > 0.0620s     2014.08.29 11:58:12 INFO [DbMigration] - add_index(:rules,[:plugin_name,:plugin_rule_key],{:unique => true,:name =>“rules_repo_key”})     2014.08.29 11:58:12 ERROR [o.s.s.ui.JRubyFacade]无法升级数据库     发生错误,此操作和所有后​​续迁移都已取消:

ActiveRecord::JDBCError: The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name 'sonar.rules' and the index name 'rules_repo_key'. The duplicate key value is (grvy, org.codenarc.rule.basic.HardCodedWindowsRootDirectoryRule).: CREATE UNIQUE INDEX [rules_repo_key] ON [rules] ([plugin_name], [plugin_rule_key])
    E:/Server/sonarqube-4.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
    E:/Server/sonarqube-4.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract_adapter.rb:212:in `log'
    E:/Server/sonarqube-4.4/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/adapter.rb:183:in `execute'
    E:/Server/sonarqube-4.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/schema_statements.rb:292:in `add_index'
    org/jruby/RubyKernel.java:2235:in `send'
    E:/Server/sonarqube-4.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:352:in `method_missing'
    E:/Server/sonarqube-4.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:328:in `say_with_time'
    jar:file:/E:/Server/sonarqube-4.4/web/WEB-INF/lib/jruby-complete-1.7.9.jar!/META-INF/jruby.home/lib/ruby/1.8/benchmark.rb:293:in `measure'
    E:/Server/sonarqube-4.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:328:in `say_with_time'
    E:/Server/sonarqube-4.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:348:in `method_missing'
    E:/Server/sonarqube-4.4/web/WEB-INF/config/environment.rb:124:in `add_index'
    E:/Server/sonarqube-4.4/web/WEB-INF/config/../lib/../db/migrate/546_inverse_rule_key_index.rb:66:in `up'
    org/jruby/RubyKernel.java:2223:in `send'
    E:/Server/sonarqube-4.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:282:in `migrate'
    jar:file:/E:/Server/sonarqube-4.4/web/WEB-INF/lib/jruby-complete-1.7.9.jar!/META-INF/jruby.home/lib/ruby/1.8/benchmark.rb:293:in `measure'
    E:/Server/sonarqube-4.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:282:in `migrate'
    org/jruby/RubyKernel.java:2227:in `send'
    E:1:in `migrate'
    E:/Server/sonarqube-4.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:491:in `migrate'
    org/jruby/RubyProc.java:290:in `call'
    org/jruby/RubyProc.java:224:in `call'
    E:/Server/sonarqube-4.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:565:in `ddl_transaction'
    E:/Server/sonarqube-4.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'
    E:/Server/sonarqube-4.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/transactions.rb:182:in `transaction'
    E:/Server/sonarqube-4.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:565:in `ddl_transaction'
    E:/Server/sonarqube-4.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:490:in `migrate'
    org/jruby/RubyArray.java:1613:in `each'
    E:/Server/sonarqube-4.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:477:in `migrate'
    E:/Server/sonarqube-4.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:401:in `up'
    E:/Server/sonarqube-4.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:383:in `migrate'
    E:/Server/sonarqube-4.4/web/WEB-INF/config/../lib/database_version.rb:62:in `upgrade_and_start'
    E:/Server/sonarqube-4.4/web/WEB-INF/app/models/database_migration_manager.rb:109:in `start_migration'
    org/jruby/RubyProc.java:290:in `call'
    org/jruby/RubyProc.java:228:in `call'

...

1 个答案:

答案 0 :(得分:0)

当我从Sonar-3.4升级到Sonarqube-4.4时,我遇到了这个问题。在测试环境中,我按照升级说明升级了数据库,但是测试服务器和数据库没有数据。然后我恢复了数据库并重新启动了声纳(这是一个糟糕的方法)。所以我删除了SonarQube,恢复了Sonar3.4.1和DB,恢复了最新的Sonar DB,再次安装Sonarqube,然后使用升级文档SonarQube中提到的“http://x.x.x.x.:9000/sonar/setup”从前端升级Sonar DB。到目前为止,它对我来说没有任何问题。