DB Upgrade from 6.7.7 to 7.9.1 fails on step #2506 "Migrate quality gate conditions using warning, period and no more supported operations'

Trying to accomplish:
Upgrade SonarQube Developer 6.7.1 to 7.9.1

Using

  • SonarSource MySQL Migrator.
  • pgloader

What I’ve done
Upgrading 6.7.1 to 6.7.7 works. However, the new instance crashes when adding the license plugin. Trying to install in the Marketplace does not work as it says “Available in Commercial Versions”. We have a commercial license and I’m using the developer version. I don’t know why I can’t install it.

Issue
After doing a 6.7.7 to 7.9.1 upgrade and migrating the db with the SonarSource MySQL Migration tool, I can see data on the db. When I start up my sonar instance and it goes through ‘Executing DB Migrations’ starting from step #1930 all the way until #2506 when it encounters the following error:

2019.10.25 19:01:24 INFO  web[ ][DbMigrations] #2505 'Fix the direction values of certain metrics (prepare for migration of conditions)'...
2019.10.25 19:01:24 INFO  web[ ][DbMigrations] #2505 'Fix the direction values of certain metrics (prepare for migration of conditions)': success | time=12ms
2019.10.25 19:01:24 INFO  web[ ][DbMigrations] #2506 'Migrate quality gate conditions using warning, period and no more supported operations'...
2019.10.25 19:01:24 ERROR web[ ][DbMigrations] #2506 'Migrate quality gate conditions using warning, period and no more supported operations': failure | time=24ms
2019.10.25 19:01:24 ERROR web[ ][DbMigrations] Executed DB migrations: failure | time=104488ms
2019.10.25 19:01:24 ERROR web[ ][o.s.s.p.d.m.DatabaseMigrationImpl] DB migration failed | time=104623ms
2019.10.25 19:01:24 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 #2506 'Migrate quality gate conditions using warning, period and no more supported operations' 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.base/java.lang.Iterable.forEach(Iterable.java:75)
	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:68)
	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.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalArgumentException: Duplicate key blocker_violations
	at org.sonar.core.util.stream.MoreCollectors.putAndFailOnDuplicateKey(MoreCollectors.java:299)
	at org.sonar.core.util.stream.MoreCollectors.lambda$uniqueIndex$9(MoreCollectors.java:260)
	at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1654)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
	at org.sonar.server.platform.db.migration.version.v76.MigrateNoMoreUsedQualityGateConditions.markConditionsUsingLeakPeriodHavingAlreadyRelatedConditionAsToBeDeleted(MigrateNoMoreUsedQualityGateConditions.java:170)
	at org.sonar.server.platform.db.migration.version.v76.MigrateNoMoreUsedQualityGateConditions.execute(MigrateNoMoreUsedQualityGateConditions.java:109)
	at org.sonar.server.platform.db.migration.step.DataChange.execute(DataChange.java:45)
	at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:75)
	... 9 common frames omitted
2019.10.25 19:09:00 INFO  web[ ][o.s.p.ProcessEntryPoint] Gracefully stopping process

How do I complete the MySQL to PostgreSQL Migration successfully?

Thanks,

Hi,

This is unfortunately a known issue : https://jira.sonarsource.com/browse/SONAR-12663

Waiting for a fix, you need to restore your backup, and to remove all conditions using the same metric in all your quality gate.

Sorry for that.
Regards

1 Like

Hi Julien,

Thanks for the help! Removing those conditions was the solution. The upgrade completed afterwards with no issues.

Thanks!

1 Like

Thanks for the update and for letting us know your issue was fixed.
I’m also happy that remaining steps finished with no issue !

1 Like

Hey Vega,

Could you please let me know , how you deleted the metric tables, I’m stuck with the same issue and we are on Oracle

Kishor,

Are you trying to upgrade to SonarQube v7.9.1 or v7.9.2? The migration issue was fixed in the latest patch of the LTS.

Colin

Hi Colin,
I am trying to upgrade from v6.7.7 to v7.9.2 . But still we getting migration error.

2020.03.04 01:15:26 INFO  web[][DbMigrations] #2502 'Archive module properties in a new project level property': success | time=12ms
2020.03.04 01:15:26 INFO  web[][DbMigrations] #2503 'Delete useless 'sonar.dbcleaner.cleanDirectory' property'...
2020.03.04 01:15:26 INFO  web[][DbMigrations] #2503 'Delete useless 'sonar.dbcleaner.cleanDirectory' property': success | time=4ms
2020.03.04 01:15:26 INFO  web[][DbMigrations] #2504 'Delete useless module and folder level measures'...
2020.03.04 01:16:26 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 6439 components processed (107 items/sec)
2020.03.04 01:17:26 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 16619 components processed (169 items/sec)
2020.03.04 01:18:26 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 30479 components processed (231 items/sec)
2020.03.04 01:19:26 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 38759 components processed (138 items/sec)
2020.03.04 01:20:26 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 40449 components processed (28 items/sec)
2020.03.04 01:21:01 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 45747 components processed (88 items/sec)
2020.03.04 01:21:01 INFO  web[][DbMigrations] #2504 'Delete useless module and folder level measures': success | time=335073ms
2020.03.04 01:21:01 INFO  web[][DbMigrations] #2505 'Fix the direction values of certain metrics (prepare for migration of conditions)'...
2020.03.04 01:21:01 INFO  web[][DbMigrations] #2505 'Fix the direction values of certain metrics (prepare for migration of conditions)': success | time=16ms
2020.03.04 01:21:01 INFO  web[][DbMigrations] #2506 'Migrate quality gate conditions using warning, period and no more supported operations'...
2020.03.04 01:21:01 ERROR web[][DbMigrations] #2506 'Migrate quality gate conditions using warning, period and no more supported operations': failure | time=86ms
2020.03.04 01:21:01 ERROR web[][DbMigrations] Executed DB migrations: failure | time=1964913ms
2020.03.04 01:21:01 ERROR web[][o.s.s.p.d.m.DatabaseMigrationImpl] DB migration failed | time=1965005ms
2020.03.04 01:21:01 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 #2506 'Migrate quality gate conditions using warning, period and no more supported operations' 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.base/java.lang.Iterable.forEach(Iterable.java:75)
        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:68)
        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.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalArgumentException: Duplicate key coverage
        at org.sonar.core.util.stream.MoreCollectors.putAndFailOnDuplicateKey(MoreCollectors.java:299)
        at org.sonar.core.util.stream.MoreCollectors.lambda$uniqueIndex$9(MoreCollectors.java:260)
        at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
        at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1654)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
        at org.sonar.server.platform.db.migration.version.v76.MigrateNoMoreUsedQualityGateConditions.markConditionsUsingLeakPeriodHavingAlreadyRelatedConditionAsToBeDeleted(MigrateNoMoreUsedQualityGateConditions.java:188)
        at org.sonar.server.platform.db.migration.version.v76.MigrateNoMoreUsedQualityGateConditions.execute(MigrateNoMoreUsedQualityGateConditions.java:113)
        at org.sonar.server.platform.db.migration.step.DataChange.execute(DataChange.java:45)
        at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:75)
        ... 9 common frames omitted

Thanks,

HI Team,

When i upgrade sonarqyube 7.5 to 7.9 LTS, am facing this isssue.
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 #2506 ‘Migrate quality gate conditions using warning, period and no more supported operations’ 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.base/java.lang.Iterable.forEach(Iterable.java:75)
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:68)
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.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalArgumentException: Duplicate key code_smells
at org.sonar.core.util.stream.MoreCollectors.putAndFailOnDuplicateKey(MoreCollectors.java:299)
at org.sonar.core.util.stream.MoreCollectors.lambda$uniqueIndex$9(MoreCollectors.java:260)
at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1654)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
at org.sonar.server.platform.db.migration.version.v76.MigrateNoMoreUsedQualityGateConditions.markConditionsUsingLeakPeriodHavingAlreadyRelatedConditionAsToBeDeleted(MigrateNoMoreUsedQualityGateConditions.java:170)
at org.sonar.server.platform.db.migration.version.v76.MigrateNoMoreUsedQualityGateConditions.execute(MigrateNoMoreUsedQualityGateConditions.java:109)
at org.sonar.server.platform.db.migration.step.DataChange.execute(DataChange.java:45)
at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:75)
… 9 common frames omitted

db migration failed for this error .

Thanks,
santhosh.k

Hi,

Are you using the SonarQube version 7.9.3 ?

Thanks

No am using 7.9.0

and we are upgraded ubuntu os version from 14 to 18

As a general rule, you should always upgrade to the latest LTS.
For instance, your issue were fixed in 7.9.2 by https://jira.sonarsource.com/browse/SONAR-12663.

Regards

Hi julien,

Thanks for update, After upgrading 7.9.3 Application is Working fine.

Thanks for support.

Thanks,
santhosh.k

Good news, thanks for confirming that your issue is fixed !

A post was split to a new topic: Fail to manually install sonar-security-plugin-7.9.0.5105.jar in 7.9.3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.