-
Notifications
You must be signed in to change notification settings - Fork 25.2k
[Zen2] VotingTombstone class #35832
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
[Zen2] VotingTombstone class #35832
Changes from 5 commits
cd64b16
3657f75
9c8d7a4
dbb21b2
1037370
f72bcbd
4454009
8f63927
e3bd0dd
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 |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
import org.elasticsearch.action.ActionRequestValidationException; | ||
import org.elasticsearch.action.support.master.MasterNodeRequest; | ||
import org.elasticsearch.cluster.ClusterState; | ||
import org.elasticsearch.cluster.coordination.CoordinationMetaData.VotingTombstone; | ||
import org.elasticsearch.cluster.node.DiscoveryNode; | ||
import org.elasticsearch.cluster.node.DiscoveryNodes; | ||
import org.elasticsearch.common.io.stream.StreamInput; | ||
|
@@ -69,10 +70,10 @@ public AddVotingTombstonesRequest(StreamInput in) throws IOException { | |
timeout = in.readTimeValue(); | ||
} | ||
|
||
Set<DiscoveryNode> resolveNodes(ClusterState currentState) { | ||
Set<VotingTombstone> resolveNodes(ClusterState currentState) { | ||
final DiscoveryNodes allNodes = currentState.nodes(); | ||
final Set<DiscoveryNode> resolvedNodes = Arrays.stream(allNodes.resolveNodes(nodeDescriptions)) | ||
.map(allNodes::get).filter(DiscoveryNode::isMasterNode).collect(Collectors.toSet()); | ||
final Set<VotingTombstone> resolvedNodes = Arrays.stream(allNodes.resolveNodes(nodeDescriptions)) | ||
.map(allNodes::get).filter(DiscoveryNode::isMasterNode).map(VotingTombstone::new).collect(Collectors.toSet()); | ||
|
||
if (resolvedNodes.isEmpty()) { | ||
throw new IllegalArgumentException("add voting tombstones request for " + Arrays.asList(nodeDescriptions) | ||
|
@@ -83,8 +84,8 @@ Set<DiscoveryNode> resolveNodes(ClusterState currentState) { | |
return resolvedNodes; | ||
} | ||
|
||
Set<DiscoveryNode> resolveNodesAndCheckMaximum(ClusterState currentState, int maxTombstoneCount, String maximumSettingKey) { | ||
final Set<DiscoveryNode> resolvedNodes = resolveNodes(currentState); | ||
Set<VotingTombstone> resolveNodesAndCheckMaximum(ClusterState currentState, int maxTombstoneCount, String maximumSettingKey) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. idem here (resolveVoting.... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And forgot "AndCheckMaximumPart" 8f63927 |
||
final Set<VotingTombstone> resolvedNodes = resolveNodes(currentState); | ||
|
||
final int oldTombstoneCount = currentState.getVotingTombstones().size(); | ||
final int newTombstoneCount = resolvedNodes.size(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,9 +30,9 @@ | |
import org.elasticsearch.cluster.block.ClusterBlockException; | ||
import org.elasticsearch.cluster.block.ClusterBlockLevel; | ||
import org.elasticsearch.cluster.coordination.CoordinationMetaData; | ||
import org.elasticsearch.cluster.coordination.CoordinationMetaData.VotingTombstone; | ||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; | ||
import org.elasticsearch.cluster.metadata.MetaData; | ||
import org.elasticsearch.cluster.node.DiscoveryNode; | ||
import org.elasticsearch.cluster.service.ClusterService; | ||
import org.elasticsearch.common.Priority; | ||
import org.elasticsearch.common.inject.Inject; | ||
|
@@ -77,10 +77,10 @@ protected void masterOperation(ClearVotingTombstonesRequest request, ClusterStat | |
final long startTimeMillis = threadPool.relativeTimeInMillis(); | ||
|
||
final Predicate<ClusterState> allTombstonedNodesRemoved = newState -> { | ||
for (DiscoveryNode tombstone : initialState.getVotingTombstones()) { | ||
for (VotingTombstone tombstone : initialState.getVotingTombstones()) { | ||
// NB checking for the existence of any node with this persistent ID, because persistent IDs are how votes are counted. | ||
// Calling nodeExists(tombstone) is insufficient because this compares on the ephemeral ID. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the second part of the comment is now superfluous as VotingTombstone does not have the ephemeral id and there is no nodeExists method that takes a voting tombstone There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
if (newState.nodes().nodeExists(tombstone.getId())) { | ||
if (newState.nodes().nodeExists(tombstone.getNodeId())) { | ||
return false; | ||
} | ||
} | ||
|
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.
maybe this should now be called
resolveVotingTombStones
?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.
f72bcbd