MySQL5 upgrade for SonarQube V7.2.1

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    – SonarQube V7.2.1

  • how is SonarQube deployed: zip, Docker, Helm
    – Zip

  • what are you trying to achieve
    – SonarQube and Databse upgrade

  • what have you tried so far to achieve this
    – I am currently using MySQL5 as the Database which has reached it’s EOL and I have tried to upgrade DB to MySQL8 which was not supported by currently installed version of SonarQube. I am reaching out for your input or any documentations on alternative approaches to transition away from MySQL5 along with SonarQube upgrade as it has come to our attention that latest versions of SonarQube does not support MySQL Database. Please provide assistance on this migration process.

Thanks,
Megha

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Hi Megha,

Welcome to the community!

You’ll want to use the DB Copy tool to migrate from MySQL to a supported DB, and then upgrade your SonarQube to either the latest version or the current LTA (long-term active version). Your upgrade path is:

7.2.1 → 7.9.6 → 8.9.10 → 9.9.4 → 10.5.1 (last step optional)

You may find these resources helpful:

If you have questions about upgrading, feel free to open a new thread for that here.

 
HTH,
Ann

Hi Ann,

Thank you for your response.

I am successfully able to migrate DB from MySQL to Postgres. However, while upgrading Sonarqube version I am facing challenges. I get the following error during upgrade from 7.2.1 to 7.9.6 with PostgresDB.

2024.05.17 05:20:45 ERROR web[][DbMigrations] #2506 'Migrate quality gate conditions using warning, period and no more supported operations': failure | time=119ms
2024.05.17 05:20:45 ERROR web[][DbMigrations] Executed DB migrations: failure | time=120ms
2024.05.17 05:20:45 ERROR web[][o.s.s.p.d.m.DatabaseMigrationImpl] DB migration failed | time=214ms
2024.05.17 05:20:45 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

Please help on this or provide any document/steps to follow to fix this error.

Thanks,
Megha

Hi Megha,

I believe there’s more to that error…?

Could you provide the full stacktrace, please?

 
Thx,
Ann

Hi Ann,

Please find the web.log below

2024.05.20 10:32:20 INFO  web[][o.s.p.ProcessEntryPoint] Starting web
2024.05.20 10:32:21 INFO  web[][o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2024.05.20 10:32:21 INFO  web[][o.s.c.e.CoreExtensionsLoader] Loaded core extensions: enterprise-edition, ce-workers, developer-scanner, developer-server, governance, license, securityreport
2024.05.20 10:32:22 INFO  web[][o.e.p.PluginsService] no modules loaded
2024.05.20 10:32:22 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.join.ParentJoinPlugin]
2024.05.20 10:32:22 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.percolator.PercolatorPlugin]
2024.05.20 10:32:22 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2024.05.20 10:32:23 INFO  web[][o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [127.0.0.1:9001]
2024.05.20 10:32:23 INFO  web[][o.s.s.p.LogServerVersion] SonarQube Server / 7.9.6.41879 / 38d385dda4435530bb4fdf77e0d28e31c401a976
2024.05.20 10:32:23 INFO  web[][o.sonar.db.Database] Create JDBC data source for jdbc:postgresql://<postgresDB Endpoint>
2024.05.20 10:32:25 INFO  web[][o.s.s.p.ServerFileSystemImpl] SonarQube home: /home/sonar/sonarqube-7.9.6
2024.05.20 10:32:25 INFO  web[][o.s.s.u.SystemPasscodeImpl] System authentication by passcode is disabled
2024.05.20 10:32:25 WARN  web[][o.s.s.p.DatabaseServerCompatibility] The database must be manually upgraded. Please backup the database and browse /setup. For more information: https://docs.sonarqube.org/latest/setup/upgrading
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin Git / 1.12.1.2064 / ed18ad2f7cbad8b77048b4b129ddded3d6b70393
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin GitHub Authentication for SonarQube / 1.5.0.870 / 153f7c7af7a264adb0fcbe5fee87bdd140a6a3a1
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin JaCoCo / 1.0.2.475 / b79a4724f3a9af1051266b4f8ca0460977295ead
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin LDAP / 2.2.0.608 / 79dc3fa4393a29667673c70182f3016288b548b7
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SAML 2.0 Authentication for SonarQube / 1.2.0.682 / 44d64e660a3c7f235962a7bcfef78bf8c87db98a
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarABAP / 3.8.0.2034 / 2904652c6ef4863eaace62c40fec0512724430e4
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarApex / 1.5.0.315 / 4ff3a145a58f3f84f1b39846a205a129d742e993
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarC# / 7.15.0.8572 / e0ad49e38a28a8fc333ba746fc998e48678f6a8b
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarCFamily / 6.3.0.11371 / 87798a096368f2cee97709b9d41b9c135ac2600c
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarCOBOL / 4.4.0.3403 / 87052f378052eedd582643a831d334123cf39965
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarCSS / 1.1.1.1010 / 365e21fd0cb9035669fc59f6fec7c8fd28a7303b
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarFlex / 2.5.1.1831 / a0c44437f6abb0feec76edd073f91fec64db2a6c
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarGo / 1.1.1.2000 / 40d55921c7a63b67386a053490d17b6723a46cd5
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarHTML / 3.1.0.1615 / 4181edb5eff5605bec82dc0aa15ecd70eaa5857f
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarJS / 5.2.1.7778 / 49f34eaeaad59868d4353d89b1fc5c02bbe51976
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarJava / 5.13.1.18282 / 568f8ed2349f48e250a9329895b9a870100dfbeb
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarKotlin / 1.5.0.315 / 4ff3a145a58f3f84f1b39846a205a129d742e993
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarPHP / 3.2.0.4868 / ec66bd5f8490677eb0ebae82aa17c2a5d9c0e5e7
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarPLI / 1.10.0.1880 / 1f78eb283a8d0c3e7f911f3259094c5696adad64
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarPLSQL / 3.4.1.2576 / a27e6384088454d7160dd39ea5ba54a9929c15f4
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarPython / 1.14.1.3143 / eed7b315b6116fe462a19c771013bf3891c92a97
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarRPG / 2.3.0.1187 / e0c75c815c1ae3955d823f1abcc8c1718b2d69f7
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarRuby / 1.5.0.315 / 4ff3a145a58f3f84f1b39846a205a129d742e993
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarScala / 1.5.0.315 / 4ff3a145a58f3f84f1b39846a205a129d742e993
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarSwift / 4.1.0.3087 / e71ead60ade025c4f22a8c29fc32ab7c90606ec9
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarTS / 1.9.0.3766 / 4a4080b78001a78d758d1d0fa0190fb9496b6f57
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarTSQL / 1.4.0.3334 / 7b4dc9eeb6301765e09583a3d570b5941223e0b4
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarVB / 7.15.0.8572 / e0ad49e38a28a8fc333ba746fc998e48678f6a8b
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarVB6 / 2.6.0.1875 / cfa6ee80615b98744158f3981fb29497101a03f5
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarXML / 2.0.1.2020 / c5b84004face582d56f110e24c29bf9c6a679e69
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin Svn / 1.9.0.1295 / 942e075773975354e32691a60bfd968065703e04
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin Vulnerability Analysis / 7.9.0.5105 / 90f56794ddd2e4e4c4265743c44e508dfff03c32
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin Vulnerability Rules for C# / 7.9.0.5105 / 90f56794ddd2e4e4c4265743c44e508dfff03c32
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin Vulnerability Rules for Java / 7.9.0.5105 / 90f56794ddd2e4e4c4265743c44e508dfff03c32
2024.05.20 10:32:26 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin Vulnerability Rules for PHP / 7.9.0.5105 / 90f56794ddd2e4e4c4265743c44e508dfff03c32
2024.05.20 10:32:27 INFO  web[][o.s.s.p.d.m.c.PostgresCharsetHandler] Verify that database charset supports UTF8
2024.05.20 10:32:28 INFO  web[][o.s.s.p.Platform] Database needs to be migrated. Please refer to https://docs.sonarqube.org/latest/setup/upgrading
2024.05.20 10:32:28 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.ws.WebServiceFilter@4509e648 [pattern=UrlPattern{inclusions=[/api/system/migrate_db.*, ...], exclusions=[/api/properties*, ...]}]
2024.05.20 10:32:28 INFO  web[][o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2024.05.20 10:34:08 INFO  web[][o.s.s.p.d.m.DatabaseMigrationImpl] Starting DB Migration and container restart
2024.05.20 10:34:08 INFO  web[][DbMigrations] Executing DB migrations...
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2200 'Populate PROJECT_BRANCHES with existing main application branches'...
2024.05.20 10:34:08 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 0 applications processed (0 items/sec)
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2200 'Populate PROJECT_BRANCHES with existing main application branches': success | time=45ms
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2201 'Add 'securityhotspotadmin' permission to all permission templates groups already having 'issueadmin''...
2024.05.20 10:34:08 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 2 permission templates groups roles processed (0 items/sec)
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2201 'Add 'securityhotspotadmin' permission to all permission templates groups already having 'issueadmin'': success | time=34ms
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2202 'Add 'securityhotspotadmin' permission to all permission templates users already having 'issueadmin''...
2024.05.20 10:34:08 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 0 permission templates users roles processed (0 items/sec)
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2202 'Add 'securityhotspotadmin' permission to all permission templates users already having 'issueadmin'': success | time=13ms
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2203 'Add 'securityhotspotadmin' permission to all groups already having 'issueadmin''...
2024.05.20 10:34:08 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 643 group roles processed (10 items/sec)
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2203 'Add 'securityhotspotadmin' permission to all groups already having 'issueadmin'': success | time=77ms
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2204 'Add 'securityhotspotadmin' permission to all users already having 'issueadmin''...
2024.05.20 10:34:08 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 0 user roles processed (0 items/sec)
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2204 'Add 'securityhotspotadmin' permission to all users already having 'issueadmin'': success | time=15ms
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2205 'Add 'from hotspot' flag to issues'...
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2205 'Add 'from hotspot' flag to issues': success | time=15ms
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2206 'Add SUBSCRIPTION column to ORGANIZATIONS table'...
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2206 'Add SUBSCRIPTION column to ORGANIZATIONS table': success | time=11ms
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2207 'Populate SUBSCRIPTION in ORGANIZATIONS'...
2024.05.20 10:34:08 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 1 organizations processed (0 items/sec)
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2207 'Populate SUBSCRIPTION in ORGANIZATIONS': success | time=20ms
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2208 'Add rules.security_standards'...
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2208 'Add rules.security_standards': success | time=9ms
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2209 'Fix missing quality profiles on organizations'...
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2209 'Fix missing quality profiles on organizations': success | time=11ms
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2210 'Add 'securityhotspotadmin' permission to templates characteristics already having 'issueadmin''...
2024.05.20 10:34:08 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 0 permission templates characteristics processed (0 items/sec)
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2210 'Add 'securityhotspotadmin' permission to templates characteristics already having 'issueadmin'': success | time=13ms
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2211 'Set SUBSCRIPTION not nullable in ORGANIZATIONS'...
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2211 'Set SUBSCRIPTION not nullable in ORGANIZATIONS': success | time=10ms
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2212 'Add index on ORGANIZATION_MEMBERS'...
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2212 'Add index on ORGANIZATION_MEMBERS': success | time=16ms
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2213 'Create table to store project ALM bindings'...
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2213 'Create table to store project ALM bindings': success | time=67ms
2024.05.20 10:34:08 INFO  web[][DbMigrations] #2300 'Populate null values of IS_EXTERNAL in RULES'...
2024.05.20 10:34:09 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 3580 rules processed (59 items/sec)
2024.05.20 10:34:09 INFO  web[][DbMigrations] #2300 'Populate null values of IS_EXTERNAL in RULES': success | time=339ms
2024.05.20 10:34:09 INFO  web[][DbMigrations] #2301 'Add IS_ADHOC column to RULES table'...
2024.05.20 10:34:09 INFO  web[][DbMigrations] #2301 'Add IS_ADHOC column to RULES table': success | time=8ms
2024.05.20 10:34:09 INFO  web[][DbMigrations] #2302 'Populate IS_AD_HOC in RULES'...
2024.05.20 10:34:09 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 6051 rules processed (100 items/sec)
2024.05.20 10:34:09 INFO  web[][DbMigrations] #2302 'Populate IS_AD_HOC in RULES': success | time=424ms
2024.05.20 10:34:09 INFO  web[][DbMigrations] #2303 'Set IS_EXTERNAL and IS_AD_HOC not nullable in RULES'...
2024.05.20 10:34:09 INFO  web[][DbMigrations] #2303 'Set IS_EXTERNAL and IS_AD_HOC not nullable in RULES': success | time=21ms
2024.05.20 10:34:09 INFO  web[][DbMigrations] #2304 'Add ad hoc related columns in RULES_METADATA'...
2024.05.20 10:34:09 INFO  web[][DbMigrations] #2304 'Add ad hoc related columns in RULES_METADATA': success | time=12ms
2024.05.20 10:34:09 INFO  web[][DbMigrations] #2312 'Add CE_QUEUE.MAIN_COMPONENT_UUID 1/3'...
2024.05.20 10:34:09 INFO  web[][DbMigrations] #2312 'Add CE_QUEUE.MAIN_COMPONENT_UUID 1/3': success | time=30ms
2024.05.20 10:34:09 INFO  web[][DbMigrations] #2313 'Add CE_ACTIVITY.MAIN_COMPONENT_UUID 1/3'...
2024.05.20 10:34:09 INFO  web[][DbMigrations] #2313 'Add CE_ACTIVITY.MAIN_COMPONENT_UUID 1/3': success | time=135ms
2024.05.20 10:34:09 INFO  web[][DbMigrations] #2314 'Populate CE_QUEUE.MAIN_COMPONENT_UUID 2/3'...
2024.05.20 10:34:09 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 0 queued tasks of branches processed (0 items/sec)
2024.05.20 10:34:09 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 0 queued tasks of PRs processed (0 items/sec)
2024.05.20 10:34:09 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 0 queued tasks of never analyzed branches processed (0 items/sec)
2024.05.20 10:34:09 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 0 queued tasks of never analyzed PRs processed (0 items/sec)
2024.05.20 10:34:09 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 0 queued tasks of main and deprecated branches processed (0 items/sec)
2024.05.20 10:34:10 INFO  web[][DbMigrations] #2314 'Populate CE_QUEUE.MAIN_COMPONENT_UUID 2/3': success | time=57ms
2024.05.20 10:34:10 INFO  web[][DbMigrations] #2315 'Populate CE_ACTIVITY.MAIN_COMPONENT_UUID 2/3'...
2024.05.20 10:34:10 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 0 Archived tasks of branches processed (0 items/sec)
2024.05.20 10:34:10 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 0 Archived tasks of PRs processed (0 items/sec)
2024.05.20 10:34:15 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 57643 Archived tasks of main and deprecated branches processed (960 items/sec)
2024.05.20 10:34:15 INFO  web[][DbMigrations] #2315 'Populate CE_ACTIVITY.MAIN_COMPONENT_UUID 2/3': success | time=5289ms
2024.05.20 10:34:15 INFO  web[][DbMigrations] #2316 'Add CE_ACTIVITY.MAIN_LAST_KEY 1/3'...
2024.05.20 10:34:15 INFO  web[][DbMigrations] #2316 'Add CE_ACTIVITY.MAIN_LAST_KEY 1/3': success | time=241ms
2024.05.20 10:34:15 INFO  web[][DbMigrations] #2317 'Populate CE_ACTIVITY.MAIN_LAST_KEY 2/3'...
2024.05.20 10:34:22 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 57643 rows of ce_activity processed (960 items/sec)
2024.05.20 10:34:22 INFO  web[][DbMigrations] #2317 'Populate CE_ACTIVITY.MAIN_LAST_KEY 2/3': success | time=6635ms
2024.05.20 10:34:22 INFO  web[][DbMigrations] #2318 'Finalize CE_QUEUE.MAIN_COMPONENT_UUID 3/3'...
2024.05.20 10:34:22 INFO  web[][DbMigrations] #2318 'Finalize CE_QUEUE.MAIN_COMPONENT_UUID 3/3': success | time=203ms
2024.05.20 10:34:22 INFO  web[][DbMigrations] #2319 'Finalize CE_ACTIVITY.MAIN_COMPONENT_UUID 3/3'...
2024.05.20 10:34:22 INFO  web[][DbMigrations] #2319 'Finalize CE_ACTIVITY.MAIN_COMPONENT_UUID 3/3': success | time=36ms
2024.05.20 10:34:22 INFO  web[][DbMigrations] #2320 'Finalize CE_ACTIVITY.MAIN_LAST_KEY 3/3'...
2024.05.20 10:34:22 INFO  web[][DbMigrations] #2320 'Finalize CE_ACTIVITY.MAIN_LAST_KEY 3/3': success | time=445ms
2024.05.20 10:34:22 INFO  web[][DbMigrations] #2321 'Increase organization key and name length'...
2024.05.20 10:34:22 INFO  web[][DbMigrations] #2321 'Increase organization key and name length': success | time=12ms
2024.05.20 10:34:22 INFO  web[][DbMigrations] #2322 'Create table CE_TASK_MESSAGE'...
2024.05.20 10:34:22 INFO  web[][DbMigrations] #2322 'Create table CE_TASK_MESSAGE': success | time=30ms
2024.05.20 10:34:22 INFO  web[][DbMigrations] #2323 'Clean orphans from deleted branches and PRs in CE_* tables'...
2024.05.20 10:34:22 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 0 orphans of deleted branch/pr processed (0 items/sec)
2024.05.20 10:34:22 INFO  web[][DbMigrations] #2323 'Clean orphans from deleted branches and PRs in CE_* tables': success | time=13ms
2024.05.20 10:34:22 INFO  web[][DbMigrations] #2324 'Create new creator permissions for applications and portfolios'...
2024.05.20 10:34:22 INFO  web[][o.s.s.p.d.m.v.v.CreateApplicationsAndPortfoliosCreatorPermissions] There is no default template for views. Skipping adding applications and portfolios creator permissions.
2024.05.20 10:34:22 INFO  web[][o.s.s.p.d.m.v.v.CreateApplicationsAndPortfoliosCreatorPermissions] Unable to find the default template [null] for views. Skipping adding applications and portfolios creator permissions.
2024.05.20 10:34:22 INFO  web[][DbMigrations] #2324 'Create new creator permissions for applications and portfolios': success | time=15ms
2024.05.20 10:34:22 INFO  web[][DbMigrations] #2325 'Add default templates for applications and portfolios'...
2024.05.20 10:34:22 INFO  web[][DbMigrations] #2325 'Add default templates for applications and portfolios': success | time=7ms
2024.05.20 10:34:22 INFO  web[][DbMigrations] #2326 'Create new creator permissions for applications and portfolios'...
2024.05.20 10:34:22 INFO  web[][o.s.s.p.d.m.v.v.CreateApplicationsAndPortfoliosCreatorPermissions] There is no default template for views. Skipping adding applications and portfolios creator permissions.
2024.05.20 10:34:22 INFO  web[][o.s.s.p.d.m.v.v.CreateApplicationsAndPortfoliosCreatorPermissions] Unable to find the default template [null] for views. Skipping adding applications and portfolios creator permissions.
2024.05.20 10:34:22 INFO  web[][DbMigrations] #2326 'Create new creator permissions for applications and portfolios': success | time=12ms
2024.05.20 10:34:22 INFO  web[][DbMigrations] #2327 'Populate default template permissions on organizations'...
2024.05.20 10:34:22 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 0 organizations processed (0 items/sec)
2024.05.20 10:34:22 INFO  web[][DbMigrations] #2327 'Populate default template permissions on organizations': success | time=11ms
2024.05.20 10:34:22 INFO  web[][DbMigrations] #2328 'Add portfolio and application creator permissions on sonar-administrators group'...
2024.05.20 10:34:22 INFO  web[][DbMigrations] #2328 'Add portfolio and application creator permissions on sonar-administrators group': success | time=25ms
2024.05.20 10:34:22 INFO  web[][DbMigrations] #2329 'Drop column DEFAULT_PERM_TEMPLATE_VIEW on organizations'...
2024.05.20 10:34:22 INFO  web[][DbMigrations] #2329 'Drop column DEFAULT_PERM_TEMPLATE_VIEW on organizations': success | time=7ms
2024.05.20 10:34:22 INFO  web[][DbMigrations] #2400 'Add column IS_OWNER_USER in ALM_APP_INSTALLS'...
2024.05.20 10:34:23 INFO  web[][DbMigrations] #2400 'Add column IS_OWNER_USER in ALM_APP_INSTALLS': success | time=7ms
2024.05.20 10:34:23 INFO  web[][DbMigrations] #2401 'Create ORGANIZATION_ALM_BINDINGS table'...
2024.05.20 10:34:23 INFO  web[][DbMigrations] #2401 'Create ORGANIZATION_ALM_BINDINGS table': success | time=33ms
2024.05.20 10:34:23 INFO  web[][DbMigrations] #2402 'Add column USER_EXTERNAL_ID in ALM_APP_INSTALLS'...
2024.05.20 10:34:23 INFO  web[][DbMigrations] #2402 'Add column USER_EXTERNAL_ID in ALM_APP_INSTALLS': success | time=12ms
2024.05.20 10:34:23 INFO  web[][DbMigrations] #2403 'Set IS_OWNER_USER not nullable in ALM_APP_INSTALLS'...
2024.05.20 10:34:23 INFO  web[][DbMigrations] #2403 'Set IS_OWNER_USER not nullable in ALM_APP_INSTALLS': success | time=7ms
2024.05.20 10:34:23 INFO  web[][DbMigrations] #2404 'Add table EVENT_COMPONENT_CHANGES'...
2024.05.20 10:34:23 INFO  web[][DbMigrations] #2404 'Add table EVENT_COMPONENT_CHANGES': success | time=38ms
2024.05.20 10:34:23 INFO  web[][DbMigrations] #2500 'Create table USER_PROPERTIES'...
2024.05.20 10:34:23 INFO  web[][DbMigrations] #2500 'Create table USER_PROPERTIES': success | time=24ms
2024.05.20 10:34:23 INFO  web[][DbMigrations] #2501 'Add index in table USER_PROPERTIES'...
2024.05.20 10:34:23 INFO  web[][DbMigrations] #2501 'Add index in table USER_PROPERTIES': success | time=9ms
2024.05.20 10:34:23 INFO  web[][DbMigrations] #2502 'Archive module properties in a new project level property'...
2024.05.20 10:34:23 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 1 module level properties processed (0 items/sec)
2024.05.20 10:34:23 INFO  web[][DbMigrations] #2502 'Archive module properties in a new project level property': success | time=113ms
2024.05.20 10:34:23 INFO  web[][DbMigrations] #2503 'Delete useless 'sonar.dbcleaner.cleanDirectory' property'...
2024.05.20 10:34:23 INFO  web[][DbMigrations] #2503 'Delete useless 'sonar.dbcleaner.cleanDirectory' property': success | time=9ms
2024.05.20 10:34:23 INFO  web[][DbMigrations] #2504 'Delete useless module and folder level measures'...
2024.05.20 10:35:10 INFO  web[][o.s.s.p.d.m.s.MassUpdate] 2073 components processed (34 items/sec)
2024.05.20 10:35:10 INFO  web[][DbMigrations] #2504 'Delete useless module and folder level measures': success | time=46832ms
2024.05.20 10:35:10 INFO  web[][DbMigrations] #2505 'Fix the direction values of certain metrics (prepare for migration of conditions)'...
2024.05.20 10:35:10 INFO  web[][DbMigrations] #2505 'Fix the direction values of certain metrics (prepare for migration of conditions)': success | time=22ms
2024.05.20 10:35:10 INFO  web[][DbMigrations] #2506 'Migrate quality gate conditions using warning, period and no more supported operations'...
2024.05.20 10:35:10 ERROR web[][DbMigrations] #2506 'Migrate quality gate conditions using warning, period and no more supported operations': failure | time=390ms
2024.05.20 10:35:10 ERROR web[][DbMigrations] Executed DB migrations: failure | time=61900ms
2024.05.20 10:35:10 ERROR web[][o.s.s.p.d.m.DatabaseMigrationImpl] DB migration failed | time=62022ms
2024.05.20 10:35:10 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:829)
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:1655)
	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,
Megha

Hi Sonar Team,

Can I get some help here, please? I am unable to upgrade my Sonar and my existing Enterprise license has also been suspended after DB migration due to the change in the Server ID and no reports are getting uploaded to the dashboard. To fix the license issue, I must upgrade the Sonar version. So, please help me to resolve this error I am facing while upgrading Sonar.

Thanks,
Megha

Hi Megha,

SonarQube 7.9.6 is really old, and I’m not sure we’re going to be able to help with something this far back. Nonetheless, it’s in the list, but I’m sure you appreciate that going this far back will require some archaeology that will need some extra time. I have flagged this for the experts, but I don’t set their timelines.

Regarding your license, please ping your sales contact for help with that.

 
Ann

Hi there @mp4,

Welcome to the community! As @ganncamp mentioned, this is a very old version of SQ, but let us try anyway.

Would you mind running the following query for me? Let us see if there are any duplicates. Judging by the error message, it seems something is duplicated - that should not be:

SELECT m.id, m.name, m.val_type, m.direction FROM metrics m WHERE m.enabled=true

Kind regards
Alain

Hi Alain,

PFA output of the query.
Sonarqube-pSQL-UpgradeDB.txt (11.4 KB)

Thanks,
Megha

Hi @alain.kermis @ganncamp

Any update on this?

Thanks,
Megha

Many thanks for the query results. I see that there are no duplications here, which leads me to believe there might be an issue with duplication in the quality gates.

Please run this query. If you feel there might be privacy concerns, please check the rows to see if there are any duplications in qgc.metric_id column for the same qgc.qgate_id:

SELECT qgc.id, qgc.qgate_id, qgc.metric_id, qgc.operator, qgc.value_error, qgc.value_warning, qgc.period FROM quality_gate_conditions qgc

Kind regards
Alain

Hi @alain.kermis

PFA
output.txt (76.8 KB)

Thanks,
Megha

Hi Megha,

Alain is off right now, I will take over from here.

There is some small corruption on your database, from the data that you shared it looks like at least one row is affected.

Could you please run following query on your database and proceed with the upgrade?
delete from quality_gate_conditions where id = 1205

Hi @Lukasz_Jarocki

I ran the query and tried to perform the upgrade but it failed with same error.

Thanks,
Megha

Hi @mp4 ,
unfortunately there are more duplicates in your table.

Please run the following query:
delete from quality_gate_conditions where id in (1198, 1204, 1205, 855, 1119)
and run the upgrade again.

@ganncamp @Lukasz_Jarocki

I have successfully migrated DB from MySQL5.7 to Postgres16.1, but the Sonarqube v7.2.1 with Postgres DB not showing any projects in the dashboard even though the data is available in the DB.

Could you please help?

Thanks
Megha

Output from the database for “projects” table

sonarqube=> \c sonarqube
psql (14.11 (Ubuntu 14.11-0ubuntu0.22.04.1), server 16.1)
WARNING: psql major version 14, server major version 16.
         Some psql features might not work.
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
You are now connected to database "sonarqube" as user "sonarqube".
sonarqube=> select count(*) from projects;
 count  
--------
 104765
(1 row)

Hi,

Did you do what Lukasz asked you to?

 
Ann

2 Likes

My issue is resolved. Thank you!

Regards,
Megha

1 Like