Uploaded image for project: 'CloudStack'
  1. CloudStack
  2. CLOUDSTACK-10186

No database selected for the transaction

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 4.9.3.0
    • Fix Version/s: None
    • Component/s: Management Server
    • Security Level: Public (Anyone can view this level - this is the default.)
    • Labels:

      Description

      Environment:

      • A cluster of CS 4.9.3 with 2 nodes on CentOS 6
      • A cluster of MariaDB with 3 nodes in multi-master mode with Galera

      I want to use MySQL-HA solution of CloudStack. When I stop the first DB server, I get the below exception frequently instead of switching to other DB server.

      2017-11-21 10:37:35,641 WARN [c.c.c.d.ManagementServerHostDaoImpl]
      (Cluster-Heartbeat-1:ctx-a32c78be) (logid:c9227f75) Unexpected
      exception,
      com.cloud.utils.exception.CloudRuntimeException: No database selected
      for the transaction
      at com.cloud.utils.db.TransactionLegacy.getConnection(TransactionLegacy.java:580)
      at com.cloud.utils.db.TransactionLegacy.prepareStatement(TransactionLegacy.java:467)
      at com.cloud.utils.db.TransactionLegacy.prepareAutoCloseStatement(TransactionLegacy.java:460)
      at com.cloud.cluster.dao.ManagementServerHostDaoImpl.update(ManagementServerHostDaoImpl.java:134)
      at sun.reflect.GeneratedMethodAccessor76.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
      at com.cloud.utils.db.TransactionContextInterceptor.invoke(TransactionContextInterceptor.java:34)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
      at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      at com.sun.proxy.$Proxy201.update(Unknown Source)
      at com.cloud.cluster.ClusterManagerImpl$4.runInContext(ClusterManagerImpl.java:554)
      at org.apache.cloudstack.managed.context.ManagedContextRunnable$1.run(ManagedContextRunnable.java:49)
      at org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:56)
      at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:103)
      at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:53)
      at org.apache.cloudstack.managed.context.ManagedContextRunnable.run(ManagedContextRunnable.java:46)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:473)
      at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:622)
      at java.lang.Thread.run(Thread.java:748)
      2017-11-21 10:37:35,641 ERROR [c.c.c.ClusterManagerImpl]
      (Cluster-Heartbeat-1:ctx-a32c78be) (logid:c9227f75) Unexpected
      exception in cluster heartbeat
      java.lang.RuntimeException: No database selected for the transaction
      at com.cloud.cluster.dao.ManagementServerHostDaoImpl.update(ManagementServerHostDaoImpl.java:148)
      at sun.reflect.GeneratedMethodAccessor76.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
      at com.cloud.utils.db.TransactionContextInterceptor.invoke(TransactionContextInterceptor.java:34)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
      at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      at com.sun.proxy.$Proxy201.update(Unknown Source)
      at com.cloud.cluster.ClusterManagerImpl$4.runInContext(ClusterManagerImpl.java:554)
      at org.apache.cloudstack.managed.context.ManagedContextRunnable$1.run(ManagedContextRunnable.java:49)
      at org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:56)
      at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:103)
      at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:53)
      at org.apache.cloudstack.managed.context.ManagedContextRunnable.run(ManagedContextRunnable.java:46)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:473)
      at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:622)
      at java.lang.Thread.run(Thread.java:748)
      Caused by: com.cloud.utils.exception.CloudRuntimeException: No
      database selected for the transaction
      at com.cloud.utils.db.TransactionLegacy.getConnection(TransactionLegacy.java:580)
      at com.cloud.utils.db.TransactionLegacy.prepareStatement(TransactionLegacy.java:467)
      at com.cloud.utils.db.TransactionLegacy.prepareAutoCloseStatement(TransactionLegacy.java:460)
      ... 26 more

      This is content of db.properties:

      cluster.node.IP=172.17.60.31
      cluster.servlet.port=9090
      region.id=1

      db.cloud.username=cloud
      db.cloud.password=ENC(<db.cloud.password>)
      db.cloud.host=csdb01.cloud.local
      db.cloud.driver=jdbc:mysql
      db.cloud.port=3306
      db.cloud.name=cloud

      db.cloud.maxActive=250
      db.cloud.maxIdle=30
      db.cloud.maxWait=10000
      db.cloud.validationQuery=SELECT 1
      db.cloud.testOnBorrow=true
      db.cloud.testWhileIdle=true
      db.cloud.timeBetweenEvictionRunsMillis=40000
      db.cloud.minEvictableIdleTimeMillis=240000
      db.cloud.poolPreparedStatements=false
      db.cloud.url.params=prepStmtCacheSize=517&cachePrepStmts=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'

      db.cloud.useSSL=true
      db.cloud.keyStore=/etc/ssl/certs/mariadb/clst01.keystore
      db.cloud.keyStorePassword=<keyStorePassword>
      db.cloud.trustStore=/etc/ssl/certs/mariadb/clst.truststore
      db.cloud.trustStorePassword=<trustStorePassword>
      db.cloud.keyStorePassphrase=vmops.com

      db.cloud.encryption.type=file
      db.cloud.encrypt.secret=ENC(<db.cloud.encrypt.secret>)

      db.usage.username=cloud
      db.usage.password=ENC(<db.usage.password>)
      db.usage.host=csdb01.cloud.local
      db.usage.driver=jdbc:mysql
      db.usage.port=3306
      db.usage.name=cloud_usage

      db.usage.maxActive=100
      db.usage.maxIdle=30
      db.usage.maxWait=10000
      db.usage.url.params=

      db.simulator.username=cloud
      db.simulator.password=cloud
      db.simulator.host=localhost
      db.simulator.driver=jdbc:mysql
      db.simulator.port=3306
      db.simulator.name=simulator
      db.simulator.maxActive=250
      db.simulator.maxIdle=30
      db.simulator.maxWait=10000
      db.simulator.autoReconnect=true

      db.ha.enabled=true
      db.ha.loadBalanceStrategy=com.cloud.utils.db.StaticStrategy

      db.cloud.slaves=csdb02.cloud.local,csdb03.cloud.local
      db.cloud.autoReconnect=true
      db.cloud.failOverReadOnly=false
      db.cloud.reconnectAtTxEnd=true
      db.cloud.autoReconnectForPools=true
      db.cloud.secondsBeforeRetryMaster=3600
      db.cloud.queriesBeforeRetryMaster=5000
      db.cloud.initialTimeout=3600

      db.usage.slaves=csdb02.cloud.local,csdb03.cloud.local
      db.usage.autoReconnect=true
      db.usage.failOverReadOnly=false
      db.usage.reconnectAtTxEnd=true
      db.usage.autoReconnectForPools=true
      db.usage.secondsBeforeRetryMaster=3600
      db.usage.queriesBeforeRetryMaster=5000
      db.usage.initialTimeout=3600

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              alireza Alireza Eskandari
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: