From 57e8bdca26b85082cf65acc915071e745840f39c Mon Sep 17 00:00:00 2001 From: Mingqiang Liang Date: Tue, 26 Nov 2024 19:54:56 -0800 Subject: [PATCH] fix integraiton test failure --- .../apache/pinot/controller/helix/SegmentStatusChecker.java | 5 ++++- .../java/org/apache/pinot/integration/tests/ClusterTest.java | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) 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-integration-test-base/src/test/java/org/apache/pinot/integration/tests/ClusterTest.java b/pinot-integration-test-base/src/test/java/org/apache/pinot/integration/tests/ClusterTest.java index 1338e9f529d3..e0f7a6f74f14 100644 --- a/pinot-integration-test-base/src/test/java/org/apache/pinot/integration/tests/ClusterTest.java +++ b/pinot-integration-test-base/src/test/java/org/apache/pinot/integration/tests/ClusterTest.java @@ -259,7 +259,9 @@ protected void startServers(int numServers) throws Exception { FileUtils.deleteQuietly(new File(TEMP_SERVER_DIR)); for (int i = 0; i < numServers; i++) { - _serverStarters.add(startOneServer(i)); + BaseServerStarter serverStarter = startOneServer(i); + _serverStarters.add(serverStarter); + _helixAdmin.enableInstance(getHelixClusterName(), serverStarter.getInstanceId(), true); } assertEquals(System.getProperty("user.timezone"), "UTC"); }