We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 45b2cf5 commit 613538eCopy full SHA for 613538e
server/src/main/java/org/elasticsearch/cluster/coordination/CoordinationMetadata.java
@@ -346,13 +346,9 @@ public void writeTo(StreamOutput out) throws IOException {
346
}
347
348
public boolean hasQuorum(Collection<String> votes) {
349
- int votedNodesCount = 0;
350
- for (String nodeId : nodeIds) {
351
- if (votes.contains(nodeId)) {
352
- votedNodesCount++;
353
- }
354
355
- return votedNodesCount * 2 > nodeIds.size();
+ final HashSet<String> intersection = new HashSet<>(nodeIds);
+ intersection.retainAll(votes);
+ return intersection.size() * 2 > nodeIds.size();
356
357
358
public Set<String> getNodeIds() {
0 commit comments