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

Upgrade to version 6.3+ fails in DB migration #1509 on column "ORGANIZATIONS.DEFAULT_PERM_TEMPLATE"

    Details

      Description

      Scenario to reproduce is following:

      • permission template created in 4.5.x with long name which populates the permission_templates.key value as following:
        adskjflkasflkasjdlkajslkdjaslkdjaslkjdlaskjdlsajkdlkasjdlkaj_20180201_232521
      • upgrade to 5.6.6 - all works nice at this point
      • upgrade to 6.7.x the upgrade fails with below:
        2018.02.02 00:04:03 INFO  web[][DbMigrations] #1509 'Populate columns ORGANIZATIONS.DEFAULT_PERM_TEMPLATE_*'...
        2018.02.02 00:04:03 ERROR web[][DbMigrations] #1509 'Populate columns ORGANIZATIONS.DEFAULT_PERM_TEMPLATE_*': failure | time=8ms
        2018.02.02 00:04:03 ERROR web[][DbMigrations] Executed DB migrations: failure | time=4159ms
        2018.02.02 00:04:03 ERROR web[][o.s.s.p.d.m.DatabaseMigrationImpl] DB migration failed | time=4290ms
        2018.02.02 00:04:03 ERROR web[][o.s.s.p.d.m.DatabaseMigrationImpl] DB migration ended with an exception
        org.sonar.server.platform.db.migration.step.MigrationStepExecutionException: Execution of migration step #1509 'Populate columns ORGANIZATIONS.DEFAULT_PERM_TEMPLATE_*' failed
                at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:79)
                at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:67)
                at java.util.Iterator.forEachRemaining(Iterator.java:116)
                at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
                at java.util.stream.ReferencePipeline$Head.forEachOrdered(ReferencePipeline.java:590)
                at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:52)
                at org.sonar.server.platform.db.migration.engine.MigrationEngineImpl.execute(MigrationEngineImpl.java:50)
                at org.sonar.server.platform.db.migration.DatabaseMigrationImpl.doUpgradeDb(DatabaseMigrationImpl.java:105)
                at org.sonar.server.platform.db.migration.DatabaseMigrationImpl.doDatabaseMigration(DatabaseMigrationImpl.java:80)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
                at java.lang.Thread.run(Thread.java:745)
        Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'default_perm_template_project' at row 1
                at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3971)
                at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909)
                at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2527)
                at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680)
                at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2490)
                at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1858)
                at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1197)
                at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
                at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
                at org.sonar.server.platform.db.migration.step.UpsertImpl.execute(UpsertImpl.java:51)
                at org.sonar.server.platform.db.migration.version.v63.PopulateDefaultPermTemplateColumnsOfOrganizations.execute(PopulateDefaultPermTemplateColumnsOfOrganizations.java:85)
                at org.sonar.server.platform.db.migration.step.DataChange.execute(DataChange.java:39)
                at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:75)
                ... 11 common frames omitted
        

      The column organizations.default_perm_template_project is limited to 40 chars while the other fields involved can store more:

      • permission_templates.kee VARCHAR 100
      • properties.text_value VARCHAR 4000

      Error exists on all databases.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                eric.hartmann Eric Hartmann
                Reporter:
                simon.brandhof Simon Brandhof
              • Votes:
                2 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: