Skip to content

Commit 97859f5

Browse files
authored
[ML] Don't make request on older nodes which don't have the ml cache info action (#116236)
1 parent 803de16 commit 97859f5

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,6 @@ tests:
226226
- class: org.elasticsearch.xpack.inference.TextEmbeddingCrudIT
227227
method: testPutE5Small_withPlatformSpecificVariant
228228
issue: https://github.com/elastic/elasticsearch/issues/113950
229-
- class: org.elasticsearch.upgrades.UpgradeClusterClientYamlTestSuiteIT
230-
method: test {p0=mixed_cluster/80_transform_jobs_crud/Test GET, start, and stop old cluster batch transforms}
231-
issue: https://github.com/elastic/elasticsearch/issues/115319
232229
- class: org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT
233230
method: test {yaml=reference/rest-api/usage/line_38}
234231
issue: https://github.com/elastic/elasticsearch/issues/113694

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)