2014-08-29 129 views
0

當試圖從4.3.2升級到Sonar 4.4時,數據庫遷移失敗,原因如下Sonar 4.4升級失敗

有沒有人看到過這個? 在jira問題中快速瀏覽了一下,但沒有發現任何相關的內容。

使用MS的SQLServer 2008

... 2014年8月29日11點58分12秒INFO [DbMigration]
2014年8月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_ref po_key「}) 2014年8月29日11時58分12秒錯誤[ossui.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' 

...

回答

0

當我從Sonar-3.4升級到Sonarqube-4.4時,我遇到了這個問題,在測試環境中,我根據升級說明升級了數據庫,但是它的測試服務器和數據庫沒有數據。然後我恢復數據庫並重新啓動聲納(這是一種糟糕的方法)。因此,我刪除了SonarQube,恢復了Sonar3.4.1和數據庫,恢復了最新的Sonar DB,再次安裝Sonarqube,然後使用升級文檔od SonarQube中提到的「http://x.x.x.x.:9000/sonar/setup」從前端升級Sonar DB。至今沒有任何問題,它工作正常。