Skip to content

Commit fff43f2

Browse files
authored
[ML] Don't make request on older nodes which don't have the ml cache info action (#116236) (#117269)
# Conflicts: # muted-tests.yml
1 parent 89d0acb commit fff43f2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportMlMemoryAction.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import java.util.Map;
4646
import java.util.Optional;
4747

48+
import static org.elasticsearch.Version.V_8_2_0;
4849
import static org.elasticsearch.xpack.core.ClientHelper.ML_ORIGIN;
4950
import static org.elasticsearch.xpack.core.ml.MachineLearningField.USE_AUTO_MACHINE_MEMORY_PERCENT;
5051
import static org.elasticsearch.xpack.ml.MachineLearning.MAX_MACHINE_MEMORY_PERCENT;
@@ -106,7 +107,11 @@ protected void masterOperation(
106107
.setTimeout(request.ackTimeout())
107108
.execute(delegate.delegateFailureAndWrap((delegate2, nodesStatsResponse) -> {
108109
TrainedModelCacheInfoAction.Request trainedModelCacheInfoRequest = new TrainedModelCacheInfoAction.Request(
109-
nodesStatsResponse.getNodes().stream().map(NodeStats::getNode).toArray(DiscoveryNode[]::new)
110+
nodesStatsResponse.getNodes()
111+
.stream()
112+
.map(NodeStats::getNode)
113+
.filter(node -> node.getVersion().onOrAfter(V_8_2_0)) // the cache info action was added in 8.2
114+
.toArray(DiscoveryNode[]::new)
110115
).timeout(request.ackTimeout());
111116

112117
parentTaskClient.execute(

0 commit comments

Comments
 (0)