Skip to content

Commit 5f20493

Browse files
authored
[ML] Refactor deprecated routes and simplify class hierarchy (#124755)
Removes deprecated routes and API parameters. The old 7.x routes for text file structure finding _text_structure/find_file_structure have been deprecated since 8 and replaced with _text_structure/find_structure. Also this PR simplifies the class hierarchy of GetDatafeedsStatsAction. Non-issue as the deprecation and removal in 9 was long signaled.
1 parent 6036a1e commit 5f20493

File tree

2 files changed

+3
-21
lines changed

2 files changed

+3
-21
lines changed

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

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@
66
*/
77
package org.elasticsearch.xpack.core.ml.action;
88

9+
import org.elasticsearch.action.ActionRequest;
910
import org.elasticsearch.action.ActionRequestValidationException;
1011
import org.elasticsearch.action.ActionType;
11-
import org.elasticsearch.action.support.master.MasterNodeReadRequest;
1212
import org.elasticsearch.cluster.ClusterState;
1313
import org.elasticsearch.cluster.node.DiscoveryNode;
1414
import org.elasticsearch.common.io.stream.StreamInput;
1515
import org.elasticsearch.common.io.stream.StreamOutput;
1616
import org.elasticsearch.common.io.stream.Writeable;
1717
import org.elasticsearch.core.Nullable;
18-
import org.elasticsearch.core.UpdateForV9;
1918
import org.elasticsearch.persistent.PersistentTasksCustomMetadata;
2019
import org.elasticsearch.tasks.CancellableTask;
2120
import org.elasticsearch.tasks.Task;
@@ -58,21 +57,14 @@ private GetDatafeedsStatsAction() {
5857
super(NAME);
5958
}
6059

61-
// This needs to be a MasterNodeReadRequest even though the corresponding transport
62-
// action is a HandledTransportAction so that in mixed version clusters it can be
63-
// serialized to older nodes where the transport action was a MasterNodeReadAction.
64-
// TODO: Make this a simple request in a future version where there is no possibility
65-
// of this request being serialized to another node.
66-
@UpdateForV9(owner = UpdateForV9.Owner.MACHINE_LEARNING)
67-
public static class Request extends MasterNodeReadRequest<Request> {
60+
public static class Request extends ActionRequest {
6861

6962
public static final String ALLOW_NO_MATCH = "allow_no_match";
7063

7164
private final String datafeedId;
7265
private boolean allowNoMatch = true;
7366

7467
public Request(String datafeedId) {
75-
super(TRAPPY_IMPLICIT_DEFAULT_MASTER_NODE_TIMEOUT);
7668
this.datafeedId = ExceptionsHelper.requireNonNull(datafeedId, DatafeedConfig.ID.getPreferredName());
7769
}
7870

x-pack/plugin/text-structure/src/main/java/org/elasticsearch/xpack/textstructure/rest/RestFindStructureAction.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
import org.elasticsearch.action.ActionListener;
1010
import org.elasticsearch.client.internal.node.NodeClient;
11-
import org.elasticsearch.core.UpdateForV9;
1211
import org.elasticsearch.rest.BaseRestHandler;
1312
import org.elasticsearch.rest.RestRequest;
1413
import org.elasticsearch.rest.Scope;
@@ -27,18 +26,9 @@
2726
@ServerlessScope(Scope.INTERNAL)
2827
public class RestFindStructureAction extends BaseRestHandler {
2928

30-
@UpdateForV9(owner = UpdateForV9.Owner.MACHINE_LEARNING)
31-
// one or more routes use ".replaces" with RestApiVersion.V_8 which will require use of REST API compatibility headers to access
32-
// that route in v9. It is unclear if this was intentional for v9, and the code has been updated to ".deprecateAndKeep" which will
33-
// continue to emit deprecations warnings but will not require any special headers to access the API in v9.
34-
// Please review and update the code and tests as needed. The original code remains commented out below for reference.
3529
@Override
3630
public List<Route> routes() {
37-
return List.of(
38-
// Route.builder(POST, BASE_PATH + "find_structure").replaces(POST, "/_ml/find_file_structure", RestApiVersion.V_8).build()
39-
new Route(POST, BASE_PATH + "find_structure"),
40-
Route.builder(POST, "/_ml/find_file_structure").deprecateAndKeep("Use the _text_structure API instead.").build()
41-
);
31+
return List.of(new Route(POST, BASE_PATH + "find_structure"));
4232
}
4333

4434
@Override

0 commit comments

Comments
 (0)