ElectMasterService.hasEnoughMasterNodes should return false if no masters were found

This is a regression introduced in #20063
This commit is contained in:
Boaz Leskes 2017-04-19 09:49:17 +02:00
parent e81bbc288a
commit 8758c541b3
1 changed files with 2 additions and 1 deletions

View File

@ -150,7 +150,8 @@ public class ElectMasterService extends AbstractComponent {
}
public boolean hasEnoughMasterNodes(Iterable<DiscoveryNode> nodes) {
return minimumMasterNodes < 1 || countMasterNodes(nodes) >= minimumMasterNodes;
final int count = countMasterNodes(nodes);
return count > 0 && (minimumMasterNodes < 0 || count >= minimumMasterNodes);
}
public boolean hasTooManyMasterNodes(Iterable<DiscoveryNode> nodes) {