如何找到“活动”快照,导致sonarqube升级到5.0失败? [英] How to find 'active' snapshots that cause sonarqube upgrade to 5.0 to fail?
问题描述
我得到与Julien Lancelot回答相同的错误:
I’m getting the same error as Julien Lancelot answered re:
2015.02.18 14:56:26 INFO web[DbMigration] == PopulateProjectsUuidColumns: migrating ====================================
2015.02.18 14:56:43 ERROR web[o.s.s.d.m.DatabaseMigrator] Fail to execute database migration: org.sonar.server.db.migrations.v50.PopulateProjectsUuidColum
nsMigration
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.lang.NullPointerException
### Cause: java.lang.NullPointerException
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26) ~[mybatis-3.2.7.jar:3.2.7]
at org.apache.ibatis.session.defaults.DefaultSqlSession.select(DefaultSqlSession.java:130) ~[mybatis-3.2.7.jar:3.2.7]
at org.apache.ibatis.session.defaults.DefaultSqlSession.select(DefaultSqlSession.java:122) ~[mybatis-3.2.7.jar:3.2.7]
at org.sonar.core.persistence.DbSession.select(DbSession.java:125) ~[sonar-core-5.0.jar:na]
at org.sonar.server.db.migrations.v50.PopulateProjectsUuidColumnsMigration.execute(PopulateProjectsUuidColumnsMigration.java:65) ~[sonar-server-5.0.jar:na]
Julian提到
在SQL查询和修改的jar的帮助下添加一些调试,
我终于找到问题来自哪里:您的项目
id 39554 有2个有效快照(1234385和1234386)。 此用例
不受管理,因为这应该永远不会发生。
With the help of the SQL query and the modified jar to add some debug, I've finally found from where the issue is coming : your project with id 39554 have 2 active snapshots (1234385 and 1234386). This use case is not managed as this should never happen.
推荐答案
由Julian通过电子邮件回答,这里是sql
Answered by Julian via email, here is the sql
SELECT snapshots.id,COUNT()FROM projects INNER JOIN快照ON
snapshots.project_id = projects.id AND snapshots.islast = true GROUP BY
snapshots.id HAVING
COUNT()> 1
SELECT snapshots.id, COUNT() FROM projects INNER JOIN snapshots ON snapshots.project_id=projects.id AND snapshots.islast=true GROUP BY snapshots.id HAVING COUNT() > 1
这篇关于如何找到“活动”快照,导致sonarqube升级到5.0失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!