我正在尝试将SonarQube v5.1升级到v5.2,但失败并出现以下错误:
ERROR web[o.s.s.d.m.DatabaseMigrator] Fail to execute database migration: org.sonar.db.version.v52.RemoveDuplicatedComponentKeys
java.lang.IllegalStateException: Error during processing of row:..................................................................
Caused by: java.sql.SQLException: Streaming result set com.mysql.jdbc.RowDataDynamic@7f872fa8 is still active. No statements may be issued when any streaming result sets are open and in use on a given connection. Ensure that you have called .close() on any active streaming result sets before attempting more queries.
2015.11.05 09:08:32 INFO web[o.s.s.d.m.PlatformDatabaseMigration] DB migration failed | time=6911ms
2015.11.05 09:08:32 ERROR web[o.s.s.d.m.PlatformDatabaseMigration] DB Migration or container restart failed. Process ended with an exception
org.jruby.exceptions.RaiseException: (StandardError) An error has occurred, all later migrations canceled:
Fail to execute database migration: org.sonar.db.version.v52.RemoveDuplicatedComponentKeys
答案 0 :(得分:0)
我找到了解决方法。我已从项目表中删除了重复的项目,然后重新启动了迁移过程。
要了解发生了什么,请在您的数据库上执行以下查询:
select p.kee, COUNT(p.kee) FROM projects p GROUP BY p.kee HAVING COUNT(p.kee) > 1;
如果此查询返回任何元素,则必须删除重复的元素(例如最旧的元素)。在我的情况下,这很容易,因为我在问题表中没有与相关项目相关的问题。
我必须逐步模仿SonarQube 5.2迁移过程(删除重复的项目并更新它们的问题),您可以在Github的迁移步骤中找到正在执行的查询列表。