From 2d81f0a8d0df8ccca37416fabaa2a3f015e18eda Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Mon, 28 Nov 2016 12:37:24 +0000 Subject: [PATCH] ARTEMIS-866 - quorum fixes remove reconnect attempt as it serves no purposes as replication has stopped anyway. Ensure if vote fails thatthe latch is counted down to avoid delay. If we can't detect live has failed signal failure in replicating. https://issues.apache.org/jira/browse/ARTEMIS-866 --- .../cluster/qourum/QuorumVoteServerConnect.java | 2 +- .../qourum/SharedNothingBackupQuorum.java | 16 +++++----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/QuorumVoteServerConnect.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/QuorumVoteServerConnect.java index 8eac44426c..582774a934 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/QuorumVoteServerConnect.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/QuorumVoteServerConnect.java @@ -111,7 +111,7 @@ public class QuorumVoteServerConnect extends QuorumVote { @Override public void allVotesCast(Topology voteTopology) { - + latch.countDown(); } @Override diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/SharedNothingBackupQuorum.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/SharedNothingBackupQuorum.java index 2f83c45ba4..b3e9c32b30 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/SharedNothingBackupQuorum.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/SharedNothingBackupQuorum.java @@ -21,7 +21,6 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.api.core.ActiveMQException; -import org.apache.activemq.artemis.api.core.ActiveMQExceptionType; import org.apache.activemq.artemis.api.core.client.SessionFailureListener; import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryInternal; import org.apache.activemq.artemis.core.client.impl.Topology; @@ -82,8 +81,6 @@ public class SharedNothingBackupQuorum implements Quorum, SessionFailureListener */ private static final int LATCH_TIMEOUT = 30; - private static final int RECONNECT_ATTEMPTS = 5; - private final Object decisionGuard = new Object(); @Override @@ -101,14 +98,11 @@ public class SharedNothingBackupQuorum implements Quorum, SessionFailureListener return; } if (!isLiveDown()) { - try { - // no point in repeating all the reconnection logic - sessionFactory.connect(RECONNECT_ATTEMPTS, false); - return; - } catch (ActiveMQException e) { - if (e.getType() != ActiveMQExceptionType.NOT_CONNECTED) - ActiveMQServerLogger.LOGGER.errorReConnecting(e); - } + //lost connection but don't know if live is down so restart as backup as we can't replicate any more + signal = BACKUP_ACTIVATION.FAILURE_REPLICATING; + } else { + // live is assumed to be down, backup fails-over + signal = BACKUP_ACTIVATION.FAIL_OVER; } if (networkHealthCheck != null && networkHealthCheck.check()) {