You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ko...@apache.org on 2013/12/19 12:49:56 UTC

git commit: updated refs/heads/master to 9190b03

Updated Branches:
  refs/heads/master 29b90e7a5 -> 9190b0305


CLOUDSTACK-5457: DBHA features is broken due to RuntimeException thrown from underlying layer. Fixed my catching in ClusterManagerImpl

Signed-off-by: Koushik Das <ko...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9190b030
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9190b030
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9190b030

Branch: refs/heads/master
Commit: 9190b03056bb48b23b78ce363d5b9debc243f524
Parents: 29b90e7
Author: Damodar Reddy <da...@citrix.com>
Authored: Thu Dec 19 16:39:08 2013 +0530
Committer: Koushik Das <ko...@apache.org>
Committed: Thu Dec 19 17:07:13 2013 +0530

----------------------------------------------------------------------
 .../src/com/cloud/cluster/ClusterManagerImpl.java | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9190b030/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java
----------------------------------------------------------------------
diff --git a/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java b/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java
index c7c3710..ca0b031 100644
--- a/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java
+++ b/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java
@@ -23,6 +23,7 @@ import java.nio.channels.SocketChannel;
 import java.rmi.RemoteException;
 import java.sql.Connection;
 import java.sql.SQLException;
+import java.sql.SQLNonTransientException;
 import java.sql.SQLRecoverableException;
 import java.util.ArrayList;
 import java.util.Date;
@@ -576,21 +577,15 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                     }
 
                     if (isRootCauseConnectionRelated(e.getCause())) {
-                        s_logger.error("DB communication problem detected, fence it");
-                        queueNotification(new ClusterManagerMessage(ClusterManagerMessage.MessageType.nodeIsolated));
+                        invalidHeartbeatConnection();
                     }
-
-                    invalidHeartbeatConnection();
                 } catch (ActiveFencingException e) {
                     queueNotification(new ClusterManagerMessage(ClusterManagerMessage.MessageType.nodeIsolated));
                 } catch (Throwable e) {
                     s_logger.error("Unexpected exception in cluster heartbeat", e);
                     if (isRootCauseConnectionRelated(e.getCause())) {
-                        s_logger.error("DB communication problem detected, fence it");
-                        queueNotification(new ClusterManagerMessage(ClusterManagerMessage.MessageType.nodeIsolated));
+                        invalidHeartbeatConnection();
                     }
-
-                    invalidHeartbeatConnection();
                 } finally {
                     txn.transitToAutoManagedConnection(TransactionLegacy.CLOUD_DB);
                     txn.close("ClusterHeartbeat");
@@ -601,8 +596,8 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
 
     private boolean isRootCauseConnectionRelated(Throwable e) {
         while (e != null) {
-            if (e instanceof SQLRecoverableException) {
-                return true;
+            if (e instanceof SQLRecoverableException || e instanceof SQLNonTransientException) {
+                    return true;
             }
 
             e = e.getCause();
@@ -625,6 +620,9 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
             Connection conn = TransactionLegacy.getStandaloneConnection();
             if (conn != null) {
                 _heartbeatConnection.reset(conn);
+            } else {
+                s_logger.error("DB communication problem detected, fence it");
+                queueNotification(new ClusterManagerMessage(ClusterManagerMessage.MessageType.nodeIsolated));
             }
             // The stand-alone connection does not have to be closed here because there will be another reference to it.
             // As a matter of fact, it will be assigned to the connection instance variable in the ConnectionConcierge class.