ARTEMIS-2793 quorum logging implies it happens when single pair

This commit is contained in:
Francesco Nigro 2020-06-04 16:35:19 +02:00
parent 1510d93901
commit 65c4c45fc2
2 changed files with 23 additions and 10 deletions

View File

@ -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)

View File

@ -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);
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);