diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/SegmentStatusChecker.java b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/SegmentStatusChecker.java index 92e86615a916..612daec16d4e 100644 --- a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/SegmentStatusChecker.java +++ b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/SegmentStatusChecker.java @@ -359,11 +359,14 @@ private void updateSegmentMetrics(String tableNameWithType, TableConfig tableCon offlineSegments.add(segment); } else if (numEVReplicasUp < numISReplicasUp) { partialOnlineSegments.add(segment); + } else { + // Do not allow numEVReplicasUp to be larger than numISReplicasUp + numEVReplicasUp = numISReplicasUp; } minEVReplicasUp = Math.min(minEVReplicasUp, numEVReplicasUp); // Total number of replicas in ideal state (including ERROR/OFFLINE states) - int numISReplicasTotal = idealState.getInstanceStateMap(segment).entrySet().size(); + int numISReplicasTotal = Math.max(idealState.getInstanceStateMap(segment).entrySet().size(), 1); minEVReplicasUpPercent = Math.min(minEVReplicasUpPercent, numEVReplicasUp * 100 / numISReplicasTotal); } diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/util/ServerInfoFetcher.java b/pinot-controller/src/main/java/org/apache/pinot/controller/util/ServerInfoFetcher.java index 7b094e6bf91b..17129495d636 100644 --- a/pinot-controller/src/main/java/org/apache/pinot/controller/util/ServerInfoFetcher.java +++ b/pinot-controller/src/main/java/org/apache/pinot/controller/util/ServerInfoFetcher.java @@ -53,7 +53,7 @@ private ServerInfo getServerInfoOndemand(String instanceId) { List tags = instanceConfig.getTags(); ZNRecord record = instanceConfig.getRecord(); boolean helixEnabled = record.getBooleanField( - InstanceConfig.InstanceConfigProperty.HELIX_ENABLED.name(), false); + InstanceConfig.InstanceConfigProperty.HELIX_ENABLED.name(), true); boolean queriesDisabled = record.getBooleanField(CommonConstants.Helix.QUERIES_DISABLED, false); boolean shutdownInProgress = record.getBooleanField(CommonConstants.Helix.IS_SHUTDOWN_IN_PROGRESS, false); return new ServerInfo(instanceId, tags, null, helixEnabled, queriesDisabled, shutdownInProgress);