Unable to downgrade Sonarqube community version from 10.2 to 10.1

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

SonarQube community 10.2

  • how is SonarQube deployed: zip, Docker, Helm

Docker

 docker-compose:
 version: "3"
 networks:
    jenkins_cicd:

services:
    sonarqube:
        build: sonarqube/.
        container_name: sonarqube
        restart: always
        ports:
            - "${SONAR_PORT}:9000"
        networks:
            - jenkins_cicd
        environment:
            - "SONAR_JDBC_URL=jdbc:${SONAR_POSTGRES_URL}"
            - "SONAR_JDBC_USERNAME=${SONAR_POSTGRES_USER}"
            - "SONAR_JDBC_PASSWORD=${SONAR_POSTGRES_PASSWORD}"
        volumes:
            - /data/docker/volumes/docker_sonarqube_conf/_data:/opt/sonarqube/conf
            - /data/docker/volumes/docker_sonarqube_logs/_data:/opt/sonarqube/logs
            - /data/docker/volumes/docker_sonarqube_data/_data:/opt/sonarqube/data
            - /data/docker/volumes/docker_sonarqube_extension/_data:/opt/sonarqube/extensions
    postgresdb:
        build: postgres/.
        container_name: postgresdb
        restart: always
        ports:
            - "${SONAR_POSTGRES_PORT}:5432"
        networks:
            - jenkins_cicd
        environment:
            - "POSTGRES_DB=${SONAR_POSTGRES_DB}"
            - "POSTGRES_USER=${SONAR_POSTGRES_USER}"
            - "POSTGRES_PASSWORD=${SONAR_POSTGRES_PASSWORD}"
        volumes:
            - /data/docker/volumes/docker_postgresql_conf/_data:/etc/postgresql
            - /data/docker/volumes/docker_postgresql_logs/_data:/var/log/postgresql
            - /data/docker/volumes/docker_postgresql_lib/_data:/var/lib/postgresql
            - /data/docker/volumes/docker_postgresql_data/_data:/var/lib/postgresql/data
  • what are you trying to achieve

I had upgraded sonarqube instance from 10.1 (community) to 10.2 (community), but I was unable to rollback/downgrade it back to 10.1.

Have attached the logs below:

2023.10.09 06:13:01 INFO  es[][o.e.i.r.RecoverySettings] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]
2023.10.09 06:13:01 INFO  es[][o.e.d.DiscoveryModule] using discovery type [single-node] and seed hosts providers [settings]
2023.10.09 06:13:01 INFO  es[][o.e.n.Node] initialized
2023.10.09 06:13:01 INFO  es[][o.e.n.Node] starting ...
2023.10.09 06:13:02 INFO  es[][o.e.t.TransportService] publish_address {127.0.0.1:32833}, bound_addresses {127.0.0.1:32833}
2023.10.09 06:13:02 INFO  es[][o.e.b.BootstrapChecks] explicitly enforcing bootstrap checks
2023.10.09 06:13:02 WARN  es[][o.e.c.c.ClusterBootstrapService] this node is locked into cluster UUID [Afy2I8Q9Q_iCL_Kg7wuSxA] but [cluster.initial_master_nodes] is set to [sonarqube]; remove this setting to avoid possible data loss caused by subsequent cluster bootstrap attempts; for further information see https://www.elastic.co/guide/en/elasticsearch/reference/8.7/important-settings.html#initial_master_nodes
2023.10.09 06:13:02 INFO  es[][o.e.c.s.MasterService] elected-as-master ([1] nodes joined)[_FINISH_ELECTION_, {sonarqube}{P_MQxQ8LSqWRD0bHtBOLVw}{NtIeLe82Q86kfRbyIKblMw}{sonarqube}{127.0.0.1}{127.0.0.1:32833}{cdfhilmrstw}{8.7.0} completing election], term: 4, version: 122, delta: master node changed {previous [], current [{sonarqube}{P_MQxQ8LSqWRD0bHtBOLVw}{NtIeLe82Q86kfRbyIKblMw}{sonarqube}{127.0.0.1}{127.0.0.1:32833}{cdfhilmrstw}{8.7.0}]}
2023.10.09 06:13:02 INFO  es[][o.e.c.s.ClusterApplierService] master node changed {previous [], current [{sonarqube}{P_MQxQ8LSqWRD0bHtBOLVw}{NtIeLe82Q86kfRbyIKblMw}{sonarqube}{127.0.0.1}{127.0.0.1:32833}{cdfhilmrstw}{8.7.0}]}, term: 4, version: 122, reason: Publication{term=4, version=122}
2023.10.09 06:13:02 INFO  es[][o.e.r.s.FileSettingsService] starting file settings watcher ...
2023.10.09 06:13:02 INFO  es[][o.e.r.s.FileSettingsService] file settings service up and running [tid=33]
2023.10.09 06:13:02 INFO  es[][o.e.h.AbstractHttpServerTransport] publish_address {127.0.0.1:9001}, bound_addresses {127.0.0.1:9001}
2023.10.09 06:13:02 INFO  es[][o.e.n.Node] started {sonarqube}{P_MQxQ8LSqWRD0bHtBOLVw}{NtIeLe82Q86kfRbyIKblMw}{sonarqube}{127.0.0.1}{127.0.0.1:32833}{cdfhilmrstw}{8.7.0}{xpack.installed=true, rack_id=sonarqube}
2023.10.09 06:13:02 INFO  es[][o.e.c.c.NodeJoinExecutor] node-join: [{sonarqube}{P_MQxQ8LSqWRD0bHtBOLVw}{NtIeLe82Q86kfRbyIKblMw}{sonarqube}{127.0.0.1}{127.0.0.1:32833}{cdfhilmrstw}{8.7.0}] with reason [completing election]
2023.10.09 06:13:03 INFO  es[][o.e.l.LicenseService] license [c89b75e0-08c6-4ec3-8dd6-b4b86794730c] mode [basic] - valid
2023.10.09 06:13:03 INFO  es[][o.e.g.GatewayService] recovered [6] indices into cluster_state
2023.10.09 06:13:03 INFO  es[][o.e.h.n.s.HealthNodeTaskExecutor] Node [{sonarqube}{P_MQxQ8LSqWRD0bHtBOLVw}] is selected as the current health node.
2023.10.09 06:13:05 INFO  es[][o.e.c.r.a.AllocationService] current.health="GREEN" message="Cluster health status changed from [RED] to [GREEN] (reason: [shards started [[metadatas][0]]])." previous.health="RED" reason="shards started [[metadatas][0]]"
2023.10.09 06:13:05 INFO  app[][o.s.a.SchedulerImpl] Process[es] is up
2023.10.09 06:13:05 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[WEB_SERVER] from [/opt/sonarqube]: /opt/java/openjdk/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp -XX:-OmitStackTraceInFastThrow --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.management/sun.management=ALL-UNNAMED --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED -Dcom.redhat.fips=false -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.*|[::1] -cp ./lib/sonar-application-10.1.0.73491.jar:/opt/sonarqube/lib/jdbc/postgresql/postgresql-42.6.0.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process3434254238740827454properties
WARNING: A terminally deprecated method in java.lang.System has been called
WARNING: System::setSecurityManager has been called by org.sonar.process.PluginSecurityManager (file:/opt/sonarqube/lib/sonar-application-10.1.0.73491.jar)
WARNING: Please consider reporting this to the maintainers of org.sonar.process.PluginSecurityManager
WARNING: System::setSecurityManager will be removed in a future release
2023.10.09 06:13:06 INFO  web[][o.s.p.ProcessEntryPoint] Starting Web Server
2023.10.09 06:13:08 INFO  web[][o.s.s.p.LogServerVersion] SonarQube Server / 10.1.0.73491 / 53c01c35c264c7e3d76cf5fb955de406f36b115e
2023.10.09 06:13:08 INFO  web[][o.s.d.DefaultDatabase] Create JDBC data source for jdbc:postgresql://postgresdb:5432/sonarqube
2023.10.09 06:13:08 INFO  web[][c.z.h.HikariDataSource] HikariPool-1 - Starting...
2023.10.09 06:13:08 INFO  web[][c.z.h.p.HikariPool] HikariPool-1 - Added connection org.postgresql.jdbc.PgConnection@5972d253
2023.10.09 06:13:08 INFO  web[][c.z.h.HikariDataSource] HikariPool-1 - Start completed.
2023.10.09 06:13:09 INFO  web[][o.s.s.p.ServerFileSystemImpl] SonarQube home: /opt/sonarqube
2023.10.09 06:13:09 INFO  web[][o.s.s.u.SystemPasscodeImpl] System authentication by passcode is disabled
2023.10.09 06:13:09 WARN  web[][o.s.c.a.AnnotationConfigApplicationContext] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdk.internal.loader.ClassLoaders$AppClassLoader@331acdad-org.sonar.server.platform.DatabaseServerCompatibility': Initialization of bean failed; nested exception is Database was upgraded to a more recent version of SonarQube. A backup must probably be restored or the DB settings are incorrect.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdk.internal.loader.ClassLoaders$AppClassLoader@331acdad-org.sonar.server.platform.DatabaseServerCompatibility': Initialization of bean failed; nested exception is Database was upgraded to a more recent version of SonarQube. A backup must probably be restored or the DB settings are incorrect.
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:628)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:920)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
        at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:187)
        at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:80)
        at org.sonar.server.platform.platformlevel.PlatformLevel2.start(PlatformLevel2.java:101)
        at org.sonar.server.platform.PlatformImpl.start(PlatformImpl.java:214)
        at org.sonar.server.platform.PlatformImpl.startLevel2Container(PlatformImpl.java:186)
        at org.sonar.server.platform.PlatformImpl.init(PlatformImpl.java:80)
        at org.sonar.server.platform.web.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:45)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4494)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4946)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322)
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
        at java.base/java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:871)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:795)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322)
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
        at java.base/java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:871)
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:249)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.StandardService.startInternal(StandardService.java:428)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:917)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.sonar.server.app.EmbeddedTomcat.start(EmbeddedTomcat.java:71)
        at org.sonar.server.app.WebServer.start(WebServer.java:55)
        at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:97)
        at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:81)
        at org.sonar.server.app.WebServer.main(WebServer.java:104)
Caused by: org.sonar.api.utils.MessageException: Database was upgraded to a more recent version of SonarQube. A backup must probably be restored or the DB settings are incorrect.
2023.10.09 06:13:09 INFO  web[][c.z.h.HikariDataSource] HikariPool-1 - Shutdown initiated...
2023.10.09 06:13:09 INFO  web[][c.z.h.HikariDataSource] HikariPool-1 - Shutdown completed.
2023.10.09 06:13:09 INFO  web[][o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2023.10.09 06:13:09 INFO  web[][o.s.p.ProcessEntryPoint] Hard stopping process
2023.10.09 06:13:09 INFO  app[][o.s.a.SchedulerImpl] Process[Web Server] is stopped
2023.10.09 06:13:10 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 143
2023.10.09 06:13:10 INFO  app[][o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2023.10.09 06:13:10 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped

means your PostgreSQL db has changed from 10.1 > 10.2 and you need to use
the - hopefully existing - db backup for the rollback.

Gilbert

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