-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Add _coordinating_only
for nodes resolving in nodes API
#30313
Changes from 3 commits
d2ef73c
2b6eac6
2c50745
1f51cf7
7a73b41
6082969
3f1a3e6
aa337fc
e905aaa
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 |
---|---|---|
|
@@ -102,9 +102,17 @@ public void testCoordinatorOnlyNodes() { | |
.map(DiscoveryNode::getId) | ||
.toArray(String[]::new); | ||
|
||
assertThat( | ||
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. I think it'd be good to keep this assertion here too. 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. Looks good now, thanks 👍 |
||
discoveryNodes.resolveNodes("_all", "data:false", "ingest:false", "master:false"), | ||
arrayContainingInAnyOrder(coordinatorOnlyNodes)); | ||
final String[] nonCoordinatorOnlyNodes = | ||
StreamSupport.stream(discoveryNodes.getNodes().values().spliterator(), false) | ||
.map(n -> n.value) | ||
.filter(n -> n.isMasterNode() || n.isDataNode() || n.isIngestNode()) | ||
.map(DiscoveryNode::getId) | ||
.toArray(String[]::new); | ||
|
||
assertThat(discoveryNodes.resolveNodes("coordinating_only:true"), arrayContainingInAnyOrder(coordinatorOnlyNodes)); | ||
assertThat(discoveryNodes.resolveNodes("_all", "data:false", "ingest:false", "master:false"), | ||
arrayContainingInAnyOrder(coordinatorOnlyNodes)); | ||
assertThat(discoveryNodes.resolveNodes("_all", "coordinating_only:false"), arrayContainingInAnyOrder(nonCoordinatorOnlyNodes)); | ||
} | ||
|
||
public void testResolveNodesIds() { | ||
|
@@ -254,6 +262,13 @@ Set<String> matchingNodeIds(DiscoveryNodes nodes) { | |
Set<String> matchingNodeIds(DiscoveryNodes nodes) { | ||
return Collections.singleton(nodes.getMasterNodeId()); | ||
} | ||
}, COORDINATING_ONLY("_coordinating_only") { | ||
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. This looks like a hangover of the previous approach - should be |
||
@Override | ||
Set<String> matchingNodeIds(DiscoveryNodes nodes) { | ||
Set<String> ids = new HashSet<>(); | ||
nodes.getCoordinatingOnlyNodes().keysIt().forEachRemaining(ids::add); | ||
return ids; | ||
} | ||
}, MASTER_ELIGIBLE(DiscoveryNode.Role.MASTER.getRoleName() + ":true") { | ||
@Override | ||
Set<String> matchingNodeIds(DiscoveryNodes nodes) { | ||
|
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.
👍