-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[Zen2] Add warning if cluster fails to form fast enough #35993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
3968ae4
a300f52
d042162
ec83236
afeb399
74364d8
f6197d7
13560a6
69c27ab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -190,7 +190,7 @@ public static class Builder { | |
| public Builder() { | ||
|
|
||
| } | ||
|
|
||
| public Builder(CoordinationMetaData state) { | ||
| this.term = state.term; | ||
| this.lastCommittedConfiguration = state.lastCommittedConfiguration; | ||
|
|
@@ -386,5 +386,17 @@ public static VotingConfiguration of(DiscoveryNode... nodes) { | |
| // this could be used in many more places - TODO use this where appropriate | ||
| return new VotingConfiguration(Arrays.stream(nodes).map(DiscoveryNode::getId).collect(Collectors.toSet())); | ||
| } | ||
|
|
||
| public String getQuorumDescription() { | ||
|
||
| if (nodeIds.isEmpty()) { | ||
| return "cluster bootstrapping"; | ||
| } else if (nodeIds.size() == 1) { | ||
| return "node with id " + nodeIds; | ||
| } else if (nodeIds.size() == 2) { | ||
| return "two nodes with ids " + nodeIds; | ||
| } else { | ||
| return "at least " + (nodeIds.size() / 2 + 1) + " nodes with ids from " + nodeIds; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,8 +32,9 @@ | |
| import org.elasticsearch.cluster.ClusterStateTaskConfig; | ||
| import org.elasticsearch.cluster.ClusterStateUpdateTask; | ||
| import org.elasticsearch.cluster.block.ClusterBlocks; | ||
| import org.elasticsearch.cluster.coordination.CoordinationMetaData.VotingConfiguration; | ||
| import org.elasticsearch.cluster.coordination.CoordinationMetaData.VotingConfigExclusion; | ||
| import org.elasticsearch.cluster.coordination.CoordinationMetaData.VotingConfiguration; | ||
| import org.elasticsearch.cluster.coordination.CoordinationState.VoteCollection; | ||
| import org.elasticsearch.cluster.coordination.FollowersChecker.FollowerCheckRequest; | ||
| import org.elasticsearch.cluster.coordination.JoinHelper.InitialJoinAccumulator; | ||
| import org.elasticsearch.cluster.metadata.MetaData; | ||
|
|
@@ -52,6 +53,7 @@ | |
| import org.elasticsearch.common.settings.ClusterSettings; | ||
| import org.elasticsearch.common.settings.Setting; | ||
| import org.elasticsearch.common.settings.Settings; | ||
| import org.elasticsearch.common.transport.TransportAddress; | ||
| import org.elasticsearch.common.unit.TimeValue; | ||
| import org.elasticsearch.common.util.concurrent.EsExecutors; | ||
| import org.elasticsearch.common.util.concurrent.ListenableFuture; | ||
|
|
@@ -931,6 +933,28 @@ protected void onFoundPeersUpdated() { | |
| discoveredNodesListener.accept(foundPeers); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| protected void warnClusterFormationFailed(DiscoveryNodes clusterStateNodes, List<TransportAddress> resolvedAddresses, | ||
| List<DiscoveryNode> foundPeers) { | ||
| final String quorumDescription; | ||
| synchronized (mutex) { | ||
| if (isInitialConfigurationSet()) { | ||
| quorumDescription = coordinationState.get().getQuorumDescription(); | ||
| } else { | ||
| quorumDescription = clusterBootstrapService.getBootstrapDescription(); | ||
| } | ||
| } | ||
|
|
||
| final VoteCollection possibleVotes = new VoteCollection(); | ||
| foundPeers.forEach(possibleVotes::addVote); | ||
| final String isQuorumOrNot = coordinationState.get().isElectionQuorum(possibleVotes) ? "is a quorum" : "is not a quorum"; | ||
|
|
||
| logger.warn("leader not discovered or elected yet: election requires {}, have discovered {} which {}; discovery " + | ||
|
||
| "continues using {} from hosts providers and {} from last-known cluster state", quorumDescription, foundPeers, | ||
| isQuorumOrNot, resolvedAddresses, | ||
| StreamSupport.stream(clusterStateNodes.spliterator(), false).map(DiscoveryNode::toString).collect(Collectors.toList())); | ||
| } | ||
| } | ||
|
|
||
| private void startElectionScheduler() { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is meant by "external cluster bootstrapping"?