mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-16 18:43:26 +01:00
CLOUDSTACK-5457: DBHA features is broken due to RuntimeException thrown from underlying layer. Fixed my catching in ClusterManagerImpl
Signed-off-by: Koushik Das <koushik@apache.org>
This commit is contained in:
parent
29b90e7a5c
commit
9190b03056
@ -23,6 +23,7 @@ import java.nio.channels.SocketChannel;
|
|||||||
import java.rmi.RemoteException;
|
import java.rmi.RemoteException;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.sql.SQLNonTransientException;
|
||||||
import java.sql.SQLRecoverableException;
|
import java.sql.SQLRecoverableException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -576,21 +577,15 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isRootCauseConnectionRelated(e.getCause())) {
|
if (isRootCauseConnectionRelated(e.getCause())) {
|
||||||
s_logger.error("DB communication problem detected, fence it");
|
|
||||||
queueNotification(new ClusterManagerMessage(ClusterManagerMessage.MessageType.nodeIsolated));
|
|
||||||
}
|
|
||||||
|
|
||||||
invalidHeartbeatConnection();
|
invalidHeartbeatConnection();
|
||||||
|
}
|
||||||
} catch (ActiveFencingException e) {
|
} catch (ActiveFencingException e) {
|
||||||
queueNotification(new ClusterManagerMessage(ClusterManagerMessage.MessageType.nodeIsolated));
|
queueNotification(new ClusterManagerMessage(ClusterManagerMessage.MessageType.nodeIsolated));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
s_logger.error("Unexpected exception in cluster heartbeat", e);
|
s_logger.error("Unexpected exception in cluster heartbeat", e);
|
||||||
if (isRootCauseConnectionRelated(e.getCause())) {
|
if (isRootCauseConnectionRelated(e.getCause())) {
|
||||||
s_logger.error("DB communication problem detected, fence it");
|
|
||||||
queueNotification(new ClusterManagerMessage(ClusterManagerMessage.MessageType.nodeIsolated));
|
|
||||||
}
|
|
||||||
|
|
||||||
invalidHeartbeatConnection();
|
invalidHeartbeatConnection();
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
txn.transitToAutoManagedConnection(TransactionLegacy.CLOUD_DB);
|
txn.transitToAutoManagedConnection(TransactionLegacy.CLOUD_DB);
|
||||||
txn.close("ClusterHeartbeat");
|
txn.close("ClusterHeartbeat");
|
||||||
@ -601,7 +596,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
|
|||||||
|
|
||||||
private boolean isRootCauseConnectionRelated(Throwable e) {
|
private boolean isRootCauseConnectionRelated(Throwable e) {
|
||||||
while (e != null) {
|
while (e != null) {
|
||||||
if (e instanceof SQLRecoverableException) {
|
if (e instanceof SQLRecoverableException || e instanceof SQLNonTransientException) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -625,6 +620,9 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
|
|||||||
Connection conn = TransactionLegacy.getStandaloneConnection();
|
Connection conn = TransactionLegacy.getStandaloneConnection();
|
||||||
if (conn != null) {
|
if (conn != null) {
|
||||||
_heartbeatConnection.reset(conn);
|
_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.
|
// 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.
|
// As a matter of fact, it will be assigned to the connection instance variable in the ConnectionConcierge class.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user