Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-13948

Migration is failing when coming from SonarQube 5.6 or before on Microsoft SQL Server

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 8.5.1, 8.6
    • Component/s: Database
    • Labels:
      None
    • Edition:
      Community
    • Production Notes:
      None

      Description

      Description

      When a user is using Microsoft SQL Server and has been using SonarQube 5.6 or before, whatever the version currently used, the migration to 8.5 is failing with the following error :

      2020.10.07 09:08:28 INFO  web[][DbMigrations] #4003 'Drop unused variation values columns in 'project_measures' table'...
      2020.10.07 09:08:28 ERROR web[][DbMigrations] #4003 'Drop unused variation values columns in 'project_measures' table': failure | time=15ms
      2020.10.07 09:08:28 ERROR web[][DbMigrations] Executed DB migrations: failure | time=15ms
      2020.10.07 09:08:28 ERROR web[][o.s.s.p.d.m.DatabaseMigrationImpl] DB migration failed | time=78ms
      ....
      Caused by: java.lang.IllegalStateException: Fail to execute ALTER TABLE project_measures DROP COLUMN variation_value_2, variation_value_3, variation_value_4, variation_value_5
      	at org.sonar.server.platform.db.migration.step.DdlChange$ContextImpl.execute(DdlChange.java:106)
      	at org.sonar.server.platform.db.migration.step.DdlChange$ContextImpl.execute(DdlChange.java:86)
      	at org.sonar.server.platform.db.migration.step.DdlChange$ContextImpl.execute(DdlChange.java:128)
      	at org.sonar.server.platform.db.migration.version.v85.DropUnusedVariationsInProjectMeasures.execute(DropUnusedVariationsInProjectMeasures.java:36)
      	at org.sonar.server.platform.db.migration.step.DdlChange.execute(DdlChange.java:45)
      	at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:75)
      	... 9 common frames omitted
      Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The object 'DF__project_m__varia__4E88ABD4' is dependent on column 'variation_value_2'.
      	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:262)
      	at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1624)
      	at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:868)
      	at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:768)
      	at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7194)
      	at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2979)
      	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:248)
      	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:223)
      	at com.microsoft.sqlserver.jdbc.SQLServerStatement.execute(SQLServerStatement.java:744)
      	at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:194)
      	at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:194)
      	at org.sonar.server.platform.db.migration.step.DdlChange$ContextImpl.execute(DdlChange.java:91)
      	... 14 common frames omitted
      

      Investigation

      This issue is coming from the fact that some columns were creating using the DEFAULT command in SonarQube 2.5, which generates some constraint on Ms SQL Server.
      These constraints must be dropped in order to allow migration to 8.5.

        Attachments

          Activity

            People

            Assignee:
            jacek.poreda Jacek Poreda
            Reporter:
            julien.lancelot Julien Lancelot
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Due:
              Created:
              Updated:
              Resolved: