From 8758c541b35bda1a6494ba703b450517027d5e9f Mon Sep 17 00:00:00 2001 From: Boaz Leskes Date: Wed, 19 Apr 2017 09:49:17 +0200 Subject: [PATCH] ElectMasterService.hasEnoughMasterNodes should return false if no masters were found This is a regression introduced in #20063 --- .../org/elasticsearch/discovery/zen/ElectMasterService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/elasticsearch/discovery/zen/ElectMasterService.java b/core/src/main/java/org/elasticsearch/discovery/zen/ElectMasterService.java index 92b20c5199b..024c50fb6e0 100644 --- a/core/src/main/java/org/elasticsearch/discovery/zen/ElectMasterService.java +++ b/core/src/main/java/org/elasticsearch/discovery/zen/ElectMasterService.java @@ -150,7 +150,8 @@ public class ElectMasterService extends AbstractComponent { } public boolean hasEnoughMasterNodes(Iterable nodes) { - return minimumMasterNodes < 1 || countMasterNodes(nodes) >= minimumMasterNodes; + final int count = countMasterNodes(nodes); + return count > 0 && (minimumMasterNodes < 0 || count >= minimumMasterNodes); } public boolean hasTooManyMasterNodes(Iterable nodes) {