You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ni...@apache.org on 2020/06/05 07:17:38 UTC
[activemq-artemis] branch master updated: ARTEMIS-2793 quorum
logging implies it happens when single pair
This is an automated email from the ASF dual-hosted git repository.
nigrofranz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/master by this push:
new 65c4c45 ARTEMIS-2793 quorum logging implies it happens when single pair
new 9a5f53a This closes #3168
65c4c45 is described below
commit 65c4c45fc235a301248035ad78852d8a4b87da45
Author: Francesco Nigro <ni...@gmail.com>
AuthorDate: Thu Jun 4 16:35:19 2020 +0200
ARTEMIS-2793 quorum logging implies it happens when single pair
---
.../artemis/core/server/ActiveMQServerLogger.java | 8 +++++++
.../core/server/cluster/qourum/QuorumManager.java | 25 +++++++++++++---------
2 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
index 9369696..782fdd5 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
@@ -443,6 +443,14 @@ public interface ActiveMQServerLogger extends BasicLogger {
@Message(id = 221082, value = "Initializing metrics plugin {0} with properties: {1}", format = Message.Format.MESSAGE_FORMAT)
void initializingMetricsPlugin(String clazz, String properties);
+ @LogMessage(level = Logger.Level.INFO)
+ @Message(id = 221083, value = "ignoring quorum vote as max cluster size is {0}.", format = Message.Format.MESSAGE_FORMAT)
+ void ignoringQuorumVote(int maxClusterSize);
+
+ @LogMessage(level = Logger.Level.INFO)
+ @Message(id = 221084, value = "Requested {0} quorum votes", format = Message.Format.MESSAGE_FORMAT)
+ void requestedQuorumVotes(int vote);
+
@LogMessage(level = Logger.Level.WARN)
@Message(id = 222000, value = "ActiveMQServer is being finalized and has not been stopped. Please remember to stop the server before letting it go out of scope",
format = Message.Format.MESSAGE_FORMAT)
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/QuorumManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/QuorumManager.java
index 7fc5a52..11be907 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/QuorumManager.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/QuorumManager.java
@@ -189,7 +189,7 @@ public final class QuorumManager implements ClusterTopologyListener, ActiveMQCom
int voteTimeout,
TimeUnit voteTimeoutUnit) {
Objects.requireNonNull(nodeID, "nodeID");
- Objects.requireNonNull(nodeID, "liveConnector");
+ Objects.requireNonNull(liveConnector, "liveConnector");
if (!started) {
throw new IllegalStateException("QuorumManager must start first");
}
@@ -199,15 +199,18 @@ public final class QuorumManager implements ClusterTopologyListener, ActiveMQCom
}
private boolean awaitVoteComplete(QuorumVoteServerConnect quorumVote, int voteTimeout, TimeUnit voteTimeoutUnit) {
+ final int maxClusterSize = this.maxClusterSize;
vote(quorumVote);
-
- try {
- quorumVote.await(voteTimeout, voteTimeoutUnit);
- } catch (InterruptedException interruption) {
- // No-op. The best the quorum can do now is to return the latest number it has
- ActiveMQServerLogger.LOGGER.quorumVoteAwaitInterrupted();
+ if (maxClusterSize > 1) {
+ try {
+ quorumVote.await(voteTimeout, voteTimeoutUnit);
+ } catch (InterruptedException interruption) {
+ // No-op. The best the quorum can do now is to return the latest number it has
+ ActiveMQServerLogger.LOGGER.quorumVoteAwaitInterrupted();
+ }
+ } else {
+ ActiveMQServerLogger.LOGGER.ignoringQuorumVote(maxClusterSize);
}
-
voteComplete(quorumVote);
return quorumVote.getDecision();
@@ -246,8 +249,10 @@ public final class QuorumManager implements ClusterTopologyListener, ActiveMQCom
runnables.add(voteRunnable);
}
}
- if (runnables.size() > 0) {
- voteRunnables.put(quorumVote, new VoteRunnableHolder(quorumVote, runnables, runnables.size()));
+ final int votes = runnables.size();
+ ActiveMQServerLogger.LOGGER.requestedQuorumVotes(votes);
+ if (votes > 0) {
+ voteRunnables.put(quorumVote, new VoteRunnableHolder(quorumVote, runnables, votes));
for (VoteRunnable runnable : runnables) {
executor.submit(runnable);