Upgrade sonarqube from 7.1 to 7.9.3 Failed

Hi,

I tried to upgrade from V7.1 to V7.9.3, but failed. I am appreciated of your help!

*Error:
#2609 ‘Delete exceeding favorites when there are more than 100 for a user’ failed

Caused by: java.sql.SQLSyntaxErrorException: ORA-00936: missing expression

*System Info:
DB: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0
JDBC: V7.1 jdbc6
V7.9.3 jdbc11

If more detailed info needed, please let me know. Thank you!

Hi, welcome to the community forum. Could you provide us more logs please? Having the full stacktrace will help to understand what is happening.

Hi Pierre,
Thanks for your quick response! Below is the stacktrace:

2020.05.27 07:26:29 INFO  web[][o.s.s.p.d.m.v.v.DeleteFavoritesExceedingOneHundred] Deleting favourites exceeding one hundred elements for 1 users
2020.05.27 07:26:29 ERROR web[][DbMigrations] #2609 'Delete exceeding favorites when there are more than 100 for a user': failure | time=77ms
2020.05.27 07:26:29 ERROR web[][DbMigrations] Executed DB migrations: failure | time=80ms
2020.05.27 07:26:29 ERROR web[][o.s.s.p.d.m.DatabaseMigrationImpl] DB migration failed | time=188ms
2020.05.27 07:26:29 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 #2609 'Delete exceeding favorites when there are more than 100 for a user' 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.sql.SQLSyntaxErrorException: ORA-00936: missing expression

        at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:509)
        at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:461)
        at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1104)
        at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:550)
        at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:268)
        at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:655)
        at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:270)
        at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:91)
        at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:970)
        at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1205)
        at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3666)
        at oracle.jdbc.driver.T4CPreparedStatement.executeInternal(T4CPreparedStatement.java:1426)
        at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3778)
        at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1081)
        at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:94)
        at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:94)
        at org.sonar.server.platform.db.migration.step.UpsertImpl.execute(UpsertImpl.java:68)
        at org.sonar.server.platform.db.migration.version.v77.DeleteFavoritesExceedingOneHundred.execute(DeleteFavoritesExceedingOneHundred.java:82)
        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
Caused by: oracle.jdbc.OracleDatabaseException: ORA-00936: missing expression

Hi,

Could you please execute the following SQL query :

SELECT user_id, sub.nb FROM
( SELECT DISTINCT user_id, COUNT (id) AS nb FROM properties WHERE prop_key = ‘favourite’ AND user_id IS NOT NULL GROUP BY user_id) sub
WHERE sub.nb > 100;

It will help to understand how much users have more than 100 favorites on your SonarQube instance.

Hi Julien,
I execute the SQL query, 1 user who has more than100 favorites. Below is the console output:

   USER_ID         NB
---------- ----------
     14680        129

Thanks for the result, it’s a good news that only one user is in this situation !

Then, in oder to fix your issue, you’ll have to do the cleanup manually :

  • Go back in version 7.1
  • Remove manually 29 of the user favorites
    • To get the user login you can execute the SQL query : “select login from users where id = 14680;”
    • In order to help the user to get the list of his favorites, you can ask him to execute the web service (he needs to be authenticated) : api/favorites/search
  • Migrate to 7.9.3

Thank you, too! I will do it & feedback to you. :slightly_smiling_face:

After reduce “favorites” property to <100, the DB migration can be finished successfully. Thank you!

Thanks for the follow up, I’m happy that you’ve been able to successfully migrate to 7.9 !

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