How to find 'active' snapshots that cause sonarqube upgrade to 5.0 to fail?

Deadly 提交于 2020-01-16 18:34:15

问题


I’m getting the same error as Julien Lancelot answered re:

Failed to upgrade SonarQube from 4.5 to 5.0.1

ie

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 mentioned

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.

How can I identify the mentioned ‘active’ snapshots and delete them so this step succeeds?


回答1:


Answered by Julian via email, here is the sql

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



来源:https://stackoverflow.com/questions/28588095/how-to-find-active-snapshots-that-cause-sonarqube-upgrade-to-5-0-to-fail

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!