从SonarQube 4.3.2升级到4.4时,“measure_data”列迁移错误(NPE)

时间:2014-09-02 12:41:19

标签: sonarqube

您好

从Sonar 4.3.2迁移到4.4数据库更新失败时出现以下异常:

2014.08.28 13:16:31 INFO [DbMigration] == MergeMeasureDataIntoProjectMeasures: migrating ============================
2014.08.28 13:16:31 INFO [DbMigration] – add_column(:project_measures, "measure_data", :binary, {:null=>true})
2014.08.28 13:28:59 INFO [DbMigration] -> 747.4790s
2014.08.28 13:28:59 INFO [DbMigration] -> 10014240 rows
2014.08.28 13:29:02 INFO [o.s.s.d.m.MassUpdater] 0 rows have been updated
2014.08.28 13:29:02 ERROR [o.s.s.d.m.DatabaseMigrator] Fail to execute database migration: org.sonar.server.db.migrations.v44.MeasureDataMigration
java.lang.IllegalStateException: java.lang.NullPointerException
2014.08.28 13:29:02 ERROR [o.s.s.ui.JRubyFacade] Fail to upgrade database
An error has occurred, all later migrations canceled:
Fail to execute database migration: org.sonar.server.db.migrations.v44.MeasureDataMigration
org.sonar.server.db.migrations.DatabaseMigrator.executeMigration(DatabaseMigrator.java:100

当尝试通过中间体4.3.3进行迁移时,然后4.3.2 - > 4.3.3迁移成功和4.3.3 - > 4.4迁移失败并出现相同的异常。

你见过这样的问题吗?你有什么建议吗?

我们找到SONAR-5249合并measure_data和project_measure表(但似乎在4.4中修复。在4.4。+范围内没有发现连接问题)

P.S。从声纳用户邮件列表中复制此问题。看起来这个问题在那里没有任何牵引力。

1 个答案:

答案 0 :(得分:0)

由于某种原因,measure_data映射表包含一个measure_id等于NULL的条目。使用

SELECT * FROM measure_data WHERE measure_id IS NULL 

检查是否是这种情况。可以使用

删除错误的条目
DELETE FROM measure_data WHERE id=${ERRONEOUS_MEASURE_DATA_ID}