ERROR Upgrade from 6.7.7 LTS to version 7.9.1 LTS (Both Enterprise Edition) #2104 'Create ALM_APP_INSTALLS table': failure

SonarQube Enterprise 7.9.1
Database Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit
Upgrade SonarQube from 6.7.7 to SonarQube Enterprise 7.9.1

When I start upgrade database I got first error

    ERROR web[][DbMigrations] #2104 'Create ALM_APP_INSTALLS table': failure | time=43ms
    ERROR web[][DbMigrations] Executed DB migrations: failure | time=5142ms
    ERROR web[][o.s.s.p.d.m.DatabaseMigrationImpl] DB migration failed | time=5232ms
    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 #2104 'Create ALM_APP_INSTALLS table' 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.IllegalStateException: Fail to execute CREATE UNIQUE INDEX alm_app_installs_owner ON alm_app_installs (alm_id, owner_id)
            at org.sonar.server.platform.db.migration.step.DdlChange$Context.execute(DdlChange.java:97)
            at org.sonar.server.platform.db.migration.step.DdlChange$Context.execute(DdlChange.java:77)
            at org.sonar.server.platform.db.migration.step.DdlChange$Context.execute(DdlChange.java:117)
            at org.sonar.server.platform.db.migration.version.v72.CreateAlmAppInstallsTable.execute(CreateAlmAppInstallsTable.java:87)
            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:75)
            ... 9 common frames omitted
    Caused by: java.sql.SQLException: ORA-01450: maximum key length (6398) exceeded

On second attempt to upgrade ALM_APP_INSTALLS table is created successfully, but appeared on antoher one:

ERROR web[][DbMigrations] #2106 'Create PROJECT_MAPPINGS table': failure | time=68ms

The 3-rd attempt to rebuild or further attempts returning error:

ERROR web[][o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
org.apache.ibatis.exceptions.PersistenceException:
### Error updating database.  Cause: org.apache.ibatis.executor.ExecutorException: Error getting generated key or setting result to parameter object. Cause: java.lang.NullPointerException
### The error may exist in org.sonar.db.metric.MetricMapper
### The error may involve org.sonar.db.metric.MetricMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO metrics (     name, description, direction, domain, short_name, qualitative, val_type, user_managed, enabled, worst_value,     best_value, optimized_best_value, hidden, delete_historical_data, decimal_scale)     VALUES (     ?, ?, ?,     ?, ?, ?,     ?, ?, ?,     ?, ?,     ?, ?, ?,     ?     )
### Cause: org.apache.ibatis.executor.ExecutorException: Error getting generated key or setting result to parameter object. Cause: java.lang.NullPointerException
        at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:199)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:184)
        at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:62)
        at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58)
        at com.sun.proxy.$Proxy26.insert(Unknown Source)
        at org.sonar.db.metric.MetricDao.insert(MetricDao.java:84)
        at org.sonar.server.startup.RegisterMetrics.save(RegisterMetrics.java:98)
        at org.sonar.server.startup.RegisterMetrics.register(RegisterMetrics.java:76)
        at org.sonar.server.startup.RegisterMetrics.start(RegisterMetrics.java:65)
        at org.sonar.core.platform.StartableCloseableSafeLifecyleStrategy.start(StartableCloseableSafeLifecyleStrategy.java:40)
        at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
        at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
        at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
        at org.picocontainer.behaviors.Stored.start(Stored.java:110)
        at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016)
        at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009)
        at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
        at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:90)
        at org.sonar.server.platform.platformlevel.PlatformLevelStartup.access$001(PlatformLevelStartup.java:47)
        at org.sonar.server.platform.platformlevel.PlatformLevelStartup$1.doPrivileged(PlatformLevelStartup.java:83)
        at org.sonar.server.user.DoPrivileged.execute(DoPrivileged.java:46)
        at org.sonar.server.platform.platformlevel.PlatformLevelStartup.start(PlatformLevelStartup.java:80)
        at org.sonar.server.platform.Platform.executeStartupTasks(Platform.java:196)
        at org.sonar.server.platform.Platform.access$400(Platform.java:46)
        at org.sonar.server.platform.Platform$1.lambda$doRun$1(Platform.java:121)
        at org.sonar.server.platform.Platform$AutoStarterRunnable.runIfNotAborted(Platform.java:371)
        at org.sonar.server.platform.Platform$1.doRun(Platform.java:121)
        at org.sonar.server.platform.Platform$AutoStarterRunnable.run(Platform.java:355)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.apache.ibatis.executor.ExecutorException: Error getting generated key or setting result to parameter object. Cause: java.lang.NullPointerException
        at org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator.processBatch(Jdbc3KeyGenerator.java:81)
        at org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator.processAfter(Jdbc3KeyGenerator.java:64)
        at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:51)
        at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74)
        at org.apache.ibatis.executor.ReuseExecutor.doUpdate(ReuseExecutor.java:52)
        at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
        at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197)
        ... 29 common frames omitted
Caused by: java.lang.NullPointerException: null
        at oracle.jdbc.driver.AutoKeyInfo.initMetaDataColumnIndexes(AutoKeyInfo.java:423)
        at oracle.jdbc.driver.AutoKeyInfo.initMetaData(AutoKeyInfo.java:396)
        at oracle.jdbc.driver.OracleReturnResultSet.getMetaData(OracleReturnResultSet.java:77)
        at org.apache.commons.dbcp2.DelegatingResultSet.getMetaData(DelegatingResultSet.java:663)
        at org.apache.commons.dbcp2.DelegatingResultSet.getMetaData(DelegatingResultSet.java:663)
        at org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator.processBatch(Jdbc3KeyGenerator.java:73)
        ... 36 common frames omitted
2019.09.02 16:20:06 INFO  web[][o.s.p.ProcessEntryPoint] Hard stopping process
2019.09.02 16:20:06 INFO  web[][o.s.s.n.NotificationDaemon] Notification service stopped
2019.09.02 16:20:06 INFO  web[][o.s.s.e.CoreExtensionStopper] Stopping Governance
2019.09.02 16:20:06 INFO  web[][o.s.s.e.CoreExtensionStopper] Stopping Governance (done) | time=0ms
2019.09.02 16:20:07 WARN  web[][o.s.p.ProcessEntryPoint$HardStopperThread] Can not stop in 1000ms
2019.09.02 16:20:07 WARN  web[][o.s.s.a.EmbeddedTomcat] Failed to stop web server
org.apache.catalina.LifecycleException: Failed to stop component [StandardServer[-1]]

So I asked DB Team to change db_block_size but Change db_block_size is not a trivial operation, to do that the database have to be created from zero and then copy the application data to the new database, also this change could affect to the performance of the database.

Any Ideas, what is root cause?

To offspings, I tried with ojdbc7 and ojdbc8. Finally I used ojdbc7-12.1.0.2.jar then worked.

2 Likes

Helllo @Mateusz_Wargulak1,

For the records, which version of Java are you running SQ with? What’s you OS?

Thanks

Hi @sns-seb,

RedHat 7.6
jdk-11.0.4

welcome