Hello,
We are currently on version 10.6 of SonarQube and tried upgrading to 24.12.0.100206-community (10.8.1) but have encountered an error with the database. We’ve tested it on our dev environment and it has worked, so we are not sure where the issue lies exactly.
Our SonarQube instance is deployed using the official helm chart and we’re also Azure Kubernetes Service (AKS) with Azure PostgreSQL Flexible Server for our database.
The helm chart upgrade and all the pods were able to start running properly, but once we got to the http://yourSonarQubeServerURL/setup that is where the error occurred with the database migration.
Here are the logs when the issue occurred:
2025.02.22 INFO web[][o.s.s.p.d.m.s.MassUpdate] 451 rows processed (7 items/sec)
2025.02.22 INFO web[][o.s.s.p.d.m.s.MassUpdate] 15528 rows processed (258 items/sec)
2025.02.22 INFO web[][o.s.s.p.d.m.s.MassUpdate] 1428 rows processed (2 items/sec)
2025.02.22 INFO web[][o.s.s.p.d.m.s.MassUpdate] 17428 rows processed (209 items/sec)
2025.02.22 INFO web[][o.s.s.p.d.m.s.MassUpdate] 342 rows processed (5 items/sec)
2025.02.22 INFO web[][o.s.s.p.d.m.s.MassUpdate] 20069 rows processed (334 items/sec)
2025.02.22 INFO web[][o.s.s.p.d.m.s.MassUpdate] 140 rows processed (2 items/sec)
2025.02.22 INFO web[][DbMigrations] 20/43 #108003 'Migrate the content of 'live measures' to 'measures' for branches': success | time=154081ms
2025.02.22 INFO web[][DbMigrations] 21/43 #108004 'Add 'measures_migrated' column on 'portfolios' table'...
2025.02.22 INFO web[][DbMigrations] 21/43 #108004 'Add 'measures_migrated' column on 'portfolios' table': success | time=26ms
2025.02.22 INFO web[][DbMigrations] 22/43 #108005 'Create index on 'portfolios.measures_migrated'...
2025.02.22 INFO web[][DbMigrations] 22/43 #108005 'Create index on 'portfolios.measures_migrated'': success | time=20ms
2025.02.22 INFO web[][DbMigrations] 23/43 #108006 'Migrate the content of 'live measures' to 'measures' for portfolios'...
2025.02.22 INFO web[][DbMigrations] 23/43 #108006 'Migrate the content of 'live measures' to 'measures' for portfolios': success | time=16ms
2025.02.22 INFO web[][DbMigrations] 24/43 #108007 'Create primary key on 'measures' table'...
2025.02.22 ERROR web[][DbMigrations] 24/43 #108007 'Create primary key on 'measures' table': failure | time=116ms
2025.02.22 ERROR web[][DbMigrations] Executed 23/43 DB migrations: failure | time=154798ms
2025.02.22 ERROR web[][o.s.s.p.d.m.DatabaseMigrationImpl] DB migration failed | time=154839ms
2025.02.22 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 #108007 'Create primary key on 'measures' table' failed
at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:112)
at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:97)
at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:70)
at org.sonar.server.platform.db.migration.engine.MigrationEngineImpl.execute(MigrationEngineImpl.java:55)
at org.sonar.server.platform.db.migration.DatabaseMigrationImpl.doUpgradeDb(DatabaseMigrationImpl.java:106)
at org.sonar.server.platform.db.migration.DatabaseMigrationImpl.doDatabaseMigration(DatabaseMigrationImpl.java:81)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalStateException: Fail to execute ALTER TABLE measures ADD CONSTRAINT pk_measures PRIMARY KEY (component_uuid)
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.version.v108.CreatePrimaryKeyOnMeasuresTable.createPrimaryKey(CreatePrimaryKeyOnMeasuresTable.java:45)
at org.sonar.server.platform.db.migration.version.v108.CreatePrimaryKeyOnMeasuresTable.execute(CreatePrimaryKeyOnMeasuresTable.java:39)
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:108)
... 8 common frames omitted
Caused by: org.postgresql.util.PSQLException: ERROR: cannot create temporary directory "pg_tblspc/16400/PG_14_202107181/pgsql_tmp": No such file or directory
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2733)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2420)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:372)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:517)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:434)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:356)
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:341)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:317)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:312)
at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:94)
at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java)
at org.sonar.server.platform.db.migration.step.DdlChange$ContextImpl.execute(DdlChange.java:91)
... 13 common frames omitted
Please let us know what you think could be the root cause. It has something to do about creating a primary key on the measures table, but I’m not sure what type of issue it is or what could be done.
Thanks,
Kevin