Sonarqube upgrade 8.1 to 8.6

Template for a good bug report, formatted with Markdown:

  • versions used (SonarQube, Scanner, Plugin, and any relevant extension)
  • error observed (wrap logs/code around triple quote ``` for proper formatting)
  • steps to reproduce
  • potential workaround

P.S.: use the #bug:fault sub-category if you’re hitting a specific crash/error , or the #bug:fp sub-category for rules-related behaviour

I am upgrading my sonarqube enterprise from 8.1.0 to 8.6.1. After upgrading in the ce.log i can see no field NEW.id

Tables extracted from the log
active_rule_parameters
active_rules
ce_queue
metrics
quality_gate_conditions
rules_parameters
rules
ce_activity
components
group_roles
projects
snapshots
events
file_sources

Please find the log below.

2021.03.06 19:28:01 ERROR ce(asgJXLgq_sNdfst57z3o][o.s.c.t.CeWorkerImpl] Failed to finalize task with uuid 'AXgJALgq_sNdznt57z3o' and persist its state to db
org.apache.ibatis.exceptions.PersistenceException:
'### Error updating database.  Cause: org.postgresql.util.PSQLException: ERROR: record "new" has no field "id"
  Where: SQL statement "SELECT NEW.id IS null"
PL/pgSQL function trigger_fct_ce_activity_idt() line 3 at IF
### The error may exist in org.sonar.db.ce.CeActivityMapper
### The error may involve org.sonar.db.ce.CeActivityMapper.insert-Inline
### The error occurred while setting parameters
### SQL: insert into ce_activity (       uuid,       component_uuid,       main_component_uuid,       analysis_uuid,       status,       task_type,       is_last,       is_last_key,       main_is_last,       main_is_last_key,       submitter_uuid,       submitted_at,       worker_uuid,       execution_count,       started_at,       executed_at,       created_at,       updated_at,       execution_time_ms,       error_message,       error_stacktrace,       error_type     )     values (       ?,       ?,       ?,       ?,       ?,       ?,       ?,       ?,       ?,       ?,       ?,       ?,       ?,       0,       ?,       ?,       ?,       ?,       ?,       ?,       ?,       ?     )
### Cause: org.postgresql.util.PSQLException: ERROR: record "new" has no field "id"
  Where: SQL statement "SELECT NEW.id IS null"
PL/pgSQL function trigger_fct_ce_activity_idt() line 3 at IF
        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$PlainMethodInvoker.invoke(MapperProxy.java:152)
        at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:85)
        at com.sun.proxy.$Proxy32.insert(Unknown Source)
        at org.sonar.db.ce.CeActivityDao.insert(CeActivityDao.java:57)
        at org.sonar.ce.queue.CeQueueImpl.remove(CeQueueImpl.java:280)
        at org.sonar.ce.queue.InternalCeQueueImpl.remove(InternalCeQueueImpl.java:119)
        at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.finalizeTask(CeWorkerImpl.java:268)
        at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.afterExecute(CeWorkerImpl.java:262)
        at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.close(CeWorkerImpl.java:222)
        at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:163)
        at org.sonar.ce.taskprocessor.CeWorkerImpl$TrackRunningState.get(CeWorkerImpl.java:137)
        at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:89)
        at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:53)
        at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
        at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:69)
        at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
        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: org.postgresql.util.PSQLException: ERROR: record "new" has no field "id"
  Where: SQL statement "SELECT NEW.id IS null"
PL/pgSQL function trigger_fct_ce_activity_idt() line 3 at IF
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2553)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2285)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:323)
        at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:481)
        at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:401)
        at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:164)
        at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:153)
        at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:94)
        at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:94)
        at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47)
        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)
        ... 24 common frames omitted

Hi,

We issued an 8.6.1 patch, likely for exactly that problem. (Too lazy at the moment to look up the exact bug.) I would advise you to use 8.6.1 instead of 8.6 except that we just released 8.7 (8.7.1 imminent, actually) so you should really try that instead.

 
Ann