Skip to content

Commit bd1a431

Browse files
committed
Consider ML as well as search nodes in test condition
1 parent 9c88cae commit bd1a431

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

server/src/test/java/org/elasticsearch/cluster/routing/allocation/WriteLoadConstraintMonitorTests.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public void testRerouteIsCalledBeforeMinimumIntervalHasPassedIfNewNodesBecomeHot
283283
Map<String, NodeUsageStatsForThreadPools> nodeUsageStatsWithExtraHotSpot = new HashMap<>();
284284
for (var entry : testState.clusterInfo.getNodeUsageStatsForThreadPools().entrySet()) {
285285
if (thresholdIncreased.get() == false
286-
&& nonSearchNodeBelowQueueLatencyThreshold(
286+
&& indexingNodeBelowQueueLatencyThreshold(
287287
testState.clusterState,
288288
entry.getKey(),
289289
entry.getValue(),
@@ -317,13 +317,15 @@ && nonSearchNodeBelowQueueLatencyThreshold(
317317
verify(testState.mockRerouteService).reroute(anyString(), eq(Priority.NORMAL), any());
318318
}
319319

320-
private boolean nonSearchNodeBelowQueueLatencyThreshold(
320+
private boolean indexingNodeBelowQueueLatencyThreshold(
321321
ClusterState clusterState,
322322
String nodeId,
323323
NodeUsageStatsForThreadPools nodeUsageStats,
324324
long latencyThresholdMillis
325325
) {
326-
return clusterState.getNodes().get(nodeId).getRoles().contains(DiscoveryNodeRole.SEARCH_ROLE) == false
326+
final var nodeRoles = clusterState.getNodes().get(nodeId).getRoles();
327+
return nodeRoles.contains(DiscoveryNodeRole.SEARCH_ROLE) == false
328+
&& nodeRoles.contains(DiscoveryNodeRole.ML_ROLE) == false
327329
&& nodeUsageStats.threadPoolUsageStatsMap()
328330
.get(ThreadPool.Names.WRITE)
329331
.maxThreadPoolQueueLatencyMillis() < latencyThresholdMillis;

0 commit comments

Comments
 (0)