Procházet zdrojové kódy

Run `TransportGetIndexAction` on local node (#125652)

This action solely needs the cluster state, it can run on any node.
Since this is the last class/action that extends the `ClusterInfo`
abstract classes, we remove those classes too as they're not required
anymore.

Relates #101805
Niels Bauman před 6 měsíci
rodič
revize
483f97915c
16 změnil soubory, kde provedl 146 přidání a 382 odebrání
  1. 5 0
      docs/changelog/125652.yaml
  2. 6 0
      qa/smoke-test-http/src/internalClusterTest/java/org/elasticsearch/http/RestActionCancellationIT.java
  3. 0 110
      qa/smoke-test-http/src/internalClusterTest/java/org/elasticsearch/http/RestClusterInfoActionCancellationIT.java
  4. 5 0
      rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.exists/10_basic.yml
  5. 0 1
      server/src/main/java/module-info.java
  6. 44 9
      server/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexRequest.java
  7. 19 2
      server/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexRequestBuilder.java
  8. 11 0
      server/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexResponse.java
  9. 42 14
      server/src/main/java/org/elasticsearch/action/admin/indices/get/TransportGetIndexAction.java
  10. 0 82
      server/src/main/java/org/elasticsearch/action/support/master/info/ClusterInfoRequest.java
  11. 0 47
      server/src/main/java/org/elasticsearch/action/support/master/info/ClusterInfoRequestBuilder.java
  12. 0 89
      server/src/main/java/org/elasticsearch/action/support/master/info/TransportClusterInfoAction.java
  13. 3 3
      server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java
  14. 8 9
      server/src/test/java/org/elasticsearch/action/admin/indices/get/GetIndexActionTests.java
  15. 2 14
      server/src/test/java/org/elasticsearch/action/admin/indices/get/GetIndexResponseTests.java
  16. 1 2
      x-pack/plugin/ql/src/main/java/org/elasticsearch/xpack/ql/index/IndexResolver.java

+ 5 - 0
docs/changelog/125652.yaml

@@ -0,0 +1,5 @@
+pr: 125652
+summary: Run `TransportGetIndexAction` on local node
+area: Indices APIs
+type: enhancement
+issues: []

+ 6 - 0
qa/smoke-test-http/src/internalClusterTest/java/org/elasticsearch/http/RestActionCancellationIT.java

@@ -15,6 +15,7 @@ import org.elasticsearch.action.admin.cluster.health.TransportClusterHealthActio
 import org.elasticsearch.action.admin.cluster.settings.ClusterGetSettingsAction;
 import org.elasticsearch.action.admin.cluster.state.ClusterStateAction;
 import org.elasticsearch.action.admin.indices.alias.get.GetAliasesAction;
+import org.elasticsearch.action.admin.indices.get.GetIndexAction;
 import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsAction;
 import org.elasticsearch.action.admin.indices.recovery.RecoveryAction;
 import org.elasticsearch.action.admin.indices.settings.get.GetSettingsAction;
@@ -115,6 +116,11 @@ public class RestActionCancellationIT extends HttpSmokeTestCase {
         runRestActionCancellationTest(new Request(HttpGet.METHOD_NAME, "/test/_mappings"), GetMappingsAction.NAME);
     }
 
+    public void testGetIndicesCancellation() {
+        createIndex("test");
+        runRestActionCancellationTest(new Request(HttpGet.METHOD_NAME, "/test"), GetIndexAction.NAME);
+    }
+
     public void testGetIndexSettingsCancellation() {
         createIndex("test");
         runRestActionCancellationTest(new Request(HttpGet.METHOD_NAME, "/test/_settings"), GetSettingsAction.NAME);

+ 0 - 110
qa/smoke-test-http/src/internalClusterTest/java/org/elasticsearch/http/RestClusterInfoActionCancellationIT.java

@@ -1,110 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the "Elastic License
- * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
- * Public License v 1"; you may not use this file except in compliance with, at
- * your election, the "Elastic License 2.0", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-package org.elasticsearch.http;
-
-import org.apache.http.client.methods.HttpGet;
-import org.elasticsearch.action.admin.indices.get.GetIndexAction;
-import org.elasticsearch.action.support.PlainActionFuture;
-import org.elasticsearch.action.support.master.AcknowledgedResponse;
-import org.elasticsearch.client.Cancellable;
-import org.elasticsearch.client.Request;
-import org.elasticsearch.client.Response;
-import org.elasticsearch.cluster.AckedClusterStateUpdateTask;
-import org.elasticsearch.cluster.ClusterState;
-import org.elasticsearch.cluster.block.ClusterBlock;
-import org.elasticsearch.cluster.block.ClusterBlockLevel;
-import org.elasticsearch.cluster.block.ClusterBlocks;
-import org.elasticsearch.cluster.service.ClusterService;
-import org.elasticsearch.core.TimeValue;
-import org.elasticsearch.rest.RestStatus;
-import org.elasticsearch.test.ESIntegTestCase;
-import org.hamcrest.Matchers;
-
-import java.util.EnumSet;
-import java.util.concurrent.CancellationException;
-import java.util.function.Function;
-
-import static org.elasticsearch.action.support.ActionTestUtils.wrapAsRestResponseListener;
-import static org.elasticsearch.test.TaskAssertions.assertAllCancellableTasksAreCancelled;
-import static org.elasticsearch.test.TaskAssertions.assertAllTasksHaveFinished;
-import static org.elasticsearch.test.TaskAssertions.awaitTaskWithPrefixOnMaster;
-import static org.hamcrest.core.IsEqual.equalTo;
-
-@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 0, numClientNodes = 0)
-public class RestClusterInfoActionCancellationIT extends HttpSmokeTestCase {
-
-    public void testGetIndicesCancellation() throws Exception {
-        runTest(GetIndexAction.NAME, "/test");
-    }
-
-    private void runTest(String actionName, String endpoint) throws Exception {
-        internalCluster().startMasterOnlyNode();
-        internalCluster().startDataOnlyNode();
-        ensureStableCluster(2);
-
-        createIndex("test");
-        ensureGreen("test");
-        // Add a retryable cluster block that would block the request execution
-        updateClusterState(currentState -> {
-            ClusterBlock clusterBlock = new ClusterBlock(
-                1000,
-                actionName + " cancellation test cluster block",
-                true,
-                false,
-                false,
-                RestStatus.BAD_REQUEST,
-                EnumSet.of(ClusterBlockLevel.METADATA_READ)
-            );
-
-            return ClusterState.builder(currentState).blocks(ClusterBlocks.builder().addGlobalBlock(clusterBlock).build()).build();
-        });
-
-        final Request request = new Request(HttpGet.METHOD_NAME, endpoint);
-        final PlainActionFuture<Response> future = new PlainActionFuture<>();
-        final Cancellable cancellable = getRestClient().performRequestAsync(request, wrapAsRestResponseListener(future));
-
-        assertThat(future.isDone(), equalTo(false));
-        awaitTaskWithPrefixOnMaster(actionName);
-        // To ensure that the task is executing on master, we wait until the first blocked execution of the task registers its cluster state
-        // observer for further retries. This ensures that a task is not cancelled before we have started its execution, which could result
-        // in the task being unregistered and the test not being able to find any cancelled tasks.
-        assertBusy(
-            () -> assertThat(
-                internalCluster().getCurrentMasterNodeInstance(ClusterService.class)
-                    .getClusterApplierService()
-                    .getTimeoutClusterStateListenersSize(),
-                Matchers.greaterThan(0)
-            )
-        );
-        cancellable.cancel();
-        assertAllCancellableTasksAreCancelled(actionName);
-
-        // Remove the cluster block
-        updateClusterState(currentState -> ClusterState.builder(currentState).blocks(ClusterBlocks.EMPTY_CLUSTER_BLOCK).build());
-
-        expectThrows(CancellationException.class, future::actionGet);
-
-        assertAllTasksHaveFinished(actionName);
-    }
-
-    private void updateClusterState(Function<ClusterState, ClusterState> transformationFn) {
-        final TimeValue timeout = TimeValue.timeValueSeconds(10);
-        PlainActionFuture<AcknowledgedResponse> future = new PlainActionFuture<>();
-        internalCluster().getAnyMasterNodeInstance(ClusterService.class)
-            .submitUnbatchedStateUpdateTask("get_mappings_cancellation_test", new AckedClusterStateUpdateTask(timeout, timeout, future) {
-                @Override
-                public ClusterState execute(ClusterState currentState) throws Exception {
-                    return transformationFn.apply(currentState);
-                }
-            });
-
-        future.actionGet();
-    }
-}

+ 5 - 0
rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.exists/10_basic.yml

@@ -17,9 +17,14 @@
   - is_true: ''
 ---
 "Test indices.exists with local flag":
+  - requires:
+      test_runner_features: ["allowed_warnings"]
+
   - do:
       indices.exists:
         index: test_index
         local: true
+      allowed_warnings:
+        - "the [?local] query parameter to this API has no effect, is now deprecated, and will be removed in a future version"
 
   - is_false: ''

+ 0 - 1
server/src/main/java/module-info.java

@@ -144,7 +144,6 @@ module org.elasticsearch.server {
     exports org.elasticsearch.action.support.broadcast.node;
     exports org.elasticsearch.action.support.broadcast.unpromotable;
     exports org.elasticsearch.action.support.master;
-    exports org.elasticsearch.action.support.master.info;
     exports org.elasticsearch.action.support.nodes;
     exports org.elasticsearch.action.support.local;
     exports org.elasticsearch.action.support.replication;

+ 44 - 9
server/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexRequest.java

@@ -9,13 +9,16 @@
 
 package org.elasticsearch.action.admin.indices.get;
 
+import org.elasticsearch.TransportVersions;
 import org.elasticsearch.action.ActionRequestValidationException;
+import org.elasticsearch.action.IndicesRequest;
 import org.elasticsearch.action.support.IndicesOptions;
-import org.elasticsearch.action.support.master.info.ClusterInfoRequest;
+import org.elasticsearch.action.support.local.LocalClusterStateRequest;
+import org.elasticsearch.common.Strings;
 import org.elasticsearch.common.io.stream.StreamInput;
-import org.elasticsearch.common.io.stream.StreamOutput;
 import org.elasticsearch.common.util.ArrayUtils;
 import org.elasticsearch.core.TimeValue;
+import org.elasticsearch.core.UpdateForV10;
 import org.elasticsearch.rest.RestRequest;
 import org.elasticsearch.tasks.CancellableTask;
 import org.elasticsearch.tasks.Task;
@@ -32,7 +35,7 @@ import java.util.Set;
 /**
  * A request to retrieve information about an index.
  */
-public class GetIndexRequest extends ClusterInfoRequest<GetIndexRequest> {
+public class GetIndexRequest extends LocalClusterStateRequest implements IndicesRequest.Replaceable {
     public enum Feature {
         ALIASES((byte) 0),
         MAPPINGS((byte) 1),
@@ -90,16 +93,30 @@ public class GetIndexRequest extends ClusterInfoRequest<GetIndexRequest> {
     }
 
     static final Feature[] DEFAULT_FEATURES = new Feature[] { Feature.ALIASES, Feature.MAPPINGS, Feature.SETTINGS };
+
+    private String[] indices = Strings.EMPTY_ARRAY;
+    private IndicesOptions indicesOptions;
     private Feature[] features = DEFAULT_FEATURES;
     private boolean humanReadable = false;
     private transient boolean includeDefaults = false;
 
     public GetIndexRequest(TimeValue masterTimeout) {
-        super(masterTimeout, IndicesOptions.strictExpandOpen());
+        super(masterTimeout);
+        indicesOptions = IndicesOptions.strictExpandOpen();
     }
 
+    /**
+     * NB prior to 9.1 this was a TransportMasterNodeReadAction so for BwC we must remain able to read these requests until
+     * we no longer need to support calling this action remotely.
+     */
+    @UpdateForV10(owner = UpdateForV10.Owner.DATA_MANAGEMENT)
     public GetIndexRequest(StreamInput in) throws IOException {
         super(in);
+        indices = in.readStringArray();
+        if (in.getTransportVersion().before(TransportVersions.V_8_0_0)) {
+            in.readStringArray();
+        }
+        indicesOptions = IndicesOptions.readIndicesOptions(in);
         features = in.readArray(i -> Feature.fromId(i.readByte()), Feature[]::new);
         humanReadable = in.readBoolean();
         includeDefaults = in.readBoolean();
@@ -162,11 +179,29 @@ public class GetIndexRequest extends ClusterInfoRequest<GetIndexRequest> {
     }
 
     @Override
-    public void writeTo(StreamOutput out) throws IOException {
-        super.writeTo(out);
-        out.writeArray((o, f) -> o.writeByte(f.id), features);
-        out.writeBoolean(humanReadable);
-        out.writeBoolean(includeDefaults);
+    public GetIndexRequest indices(String... indices) {
+        this.indices = indices;
+        return this;
+    }
+
+    public GetIndexRequest indicesOptions(IndicesOptions indicesOptions) {
+        this.indicesOptions = indicesOptions;
+        return this;
+    }
+
+    @Override
+    public String[] indices() {
+        return indices;
+    }
+
+    @Override
+    public IndicesOptions indicesOptions() {
+        return indicesOptions;
+    }
+
+    @Override
+    public boolean includeDataStreams() {
+        return true;
     }
 
     @Override

+ 19 - 2
server/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexRequestBuilder.java

@@ -9,17 +9,34 @@
 
 package org.elasticsearch.action.admin.indices.get;
 
+import org.elasticsearch.action.ActionRequestBuilder;
 import org.elasticsearch.action.admin.indices.get.GetIndexRequest.Feature;
-import org.elasticsearch.action.support.master.info.ClusterInfoRequestBuilder;
+import org.elasticsearch.action.support.IndicesOptions;
 import org.elasticsearch.client.internal.ElasticsearchClient;
+import org.elasticsearch.common.util.ArrayUtils;
 import org.elasticsearch.core.TimeValue;
 
-public class GetIndexRequestBuilder extends ClusterInfoRequestBuilder<GetIndexRequest, GetIndexResponse, GetIndexRequestBuilder> {
+public class GetIndexRequestBuilder extends ActionRequestBuilder<GetIndexRequest, GetIndexResponse> {
 
     public GetIndexRequestBuilder(ElasticsearchClient client, TimeValue masterTimeout, String... indices) {
         super(client, GetIndexAction.INSTANCE, new GetIndexRequest(masterTimeout).indices(indices));
     }
 
+    public GetIndexRequestBuilder setIndices(String... indices) {
+        request.indices(indices);
+        return this;
+    }
+
+    public GetIndexRequestBuilder addIndices(String... indices) {
+        request.indices(ArrayUtils.concat(request.indices(), indices));
+        return this;
+    }
+
+    public GetIndexRequestBuilder setIndicesOptions(IndicesOptions indicesOptions) {
+        request.indicesOptions(indicesOptions);
+        return this;
+    }
+
     public GetIndexRequestBuilder setFeatures(Feature... features) {
         request.features(features);
         return this;

+ 11 - 0
server/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexResponse.java

@@ -19,6 +19,7 @@ import org.elasticsearch.common.io.stream.StreamInput;
 import org.elasticsearch.common.io.stream.StreamOutput;
 import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.common.xcontent.ChunkedToXContentObject;
+import org.elasticsearch.core.UpdateForV10;
 import org.elasticsearch.index.mapper.MapperService;
 import org.elasticsearch.xcontent.ToXContent;
 
@@ -69,6 +70,11 @@ public class GetIndexResponse extends ActionResponse implements ChunkedToXConten
         }
     }
 
+    /**
+     * The only usage of this constructor is for BwC cross-cluster transforms for clusters before v8.2. The ML team is aware that we
+     * don't need to support that anymore now that we're on v9. Once they remove that BwC code, we can remove this constructor as well.
+     */
+    @UpdateForV10(owner = UpdateForV10.Owner.DATA_MANAGEMENT)
     GetIndexResponse(StreamInput in) throws IOException {
         this.indices = in.readStringArray();
         mappings = in.readImmutableOpenMap(StreamInput::readString, in.getTransportVersion().before(TransportVersions.V_8_0_0) ? i -> {
@@ -165,6 +171,11 @@ public class GetIndexResponse extends ActionResponse implements ChunkedToXConten
         }
     }
 
+    /**
+     * NB prior to 9.1 this was a TransportMasterNodeReadAction so for BwC we must remain able to write these responses until
+     * we no longer need to support calling this action remotely.
+     */
+    @UpdateForV10(owner = UpdateForV10.Owner.DATA_MANAGEMENT)
     @Override
     public void writeTo(StreamOutput out) throws IOException {
         out.writeStringArray(indices);

+ 42 - 14
server/src/main/java/org/elasticsearch/action/admin/indices/get/TransportGetIndexAction.java

@@ -12,8 +12,11 @@ package org.elasticsearch.action.admin.indices.get;
 import org.elasticsearch.action.ActionListener;
 import org.elasticsearch.action.admin.indices.get.GetIndexRequest.Feature;
 import org.elasticsearch.action.support.ActionFilters;
-import org.elasticsearch.action.support.master.info.TransportClusterInfoAction;
-import org.elasticsearch.cluster.ClusterState;
+import org.elasticsearch.action.support.ChannelActionListener;
+import org.elasticsearch.action.support.local.TransportLocalProjectMetadataAction;
+import org.elasticsearch.cluster.ProjectState;
+import org.elasticsearch.cluster.block.ClusterBlockException;
+import org.elasticsearch.cluster.block.ClusterBlockLevel;
 import org.elasticsearch.cluster.metadata.AliasMetadata;
 import org.elasticsearch.cluster.metadata.IndexMetadata;
 import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
@@ -25,6 +28,7 @@ import org.elasticsearch.common.collect.ImmutableOpenMap;
 import org.elasticsearch.common.settings.IndexScopedSettings;
 import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.common.settings.SettingsFilter;
+import org.elasticsearch.core.UpdateForV10;
 import org.elasticsearch.indices.IndicesService;
 import org.elasticsearch.injection.guice.Inject;
 import org.elasticsearch.tasks.CancellableTask;
@@ -41,12 +45,19 @@ import java.util.stream.Collectors;
 /**
  * Get index action.
  */
-public class TransportGetIndexAction extends TransportClusterInfoAction<GetIndexRequest, GetIndexResponse> {
+public class TransportGetIndexAction extends TransportLocalProjectMetadataAction<GetIndexRequest, GetIndexResponse> {
 
     private final IndicesService indicesService;
     private final IndexScopedSettings indexScopedSettings;
     private final SettingsFilter settingsFilter;
+    private final IndexNameExpressionResolver indexNameExpressionResolver;
 
+    /**
+     * NB prior to 9.1 this was a TransportMasterNodeReadAction so for BwC it must be registered with the TransportService until
+     * we no longer need to support calling this action remotely.
+     */
+    @UpdateForV10(owner = UpdateForV10.Owner.DATA_MANAGEMENT)
+    @SuppressWarnings("this-escape")
     @Inject
     public TransportGetIndexAction(
         TransportService transportService,
@@ -61,33 +72,50 @@ public class TransportGetIndexAction extends TransportClusterInfoAction<GetIndex
     ) {
         super(
             GetIndexAction.NAME,
-            transportService,
-            clusterService,
-            threadPool,
             actionFilters,
-            GetIndexRequest::new,
-            indexNameExpressionResolver,
-            GetIndexResponse::new,
+            transportService.getTaskManager(),
+            clusterService,
+            threadPool.executor(ThreadPool.Names.MANAGEMENT),
             projectResolver
         );
         this.indicesService = indicesService;
         this.settingsFilter = settingsFilter;
         this.indexScopedSettings = indexScopedSettings;
+        this.indexNameExpressionResolver = indexNameExpressionResolver;
+
+        transportService.registerRequestHandler(
+            actionName,
+            executor,
+            false,
+            true,
+            GetIndexRequest::new,
+            (request, channel, task) -> executeDirect(task, request, new ChannelActionListener<>(channel))
+        );
     }
 
     @Override
-    protected void doMasterOperation(
+    protected ClusterBlockException checkBlock(GetIndexRequest request, ProjectState state) {
+        return state.blocks()
+            .indicesBlockedException(
+                state.projectId(),
+                ClusterBlockLevel.METADATA_READ,
+                indexNameExpressionResolver.concreteIndexNames(state.metadata(), request)
+            );
+    }
+
+    @Override
+    protected void localClusterStateOperation(
         Task task,
         final GetIndexRequest request,
-        String[] concreteIndices,
-        final ClusterState state,
+        final ProjectState state,
         final ActionListener<GetIndexResponse> listener
-    ) {
+    ) throws Exception {
+        String[] concreteIndices = indexNameExpressionResolver.concreteIndexNames(state.metadata(), request);
         Map<String, MappingMetadata> mappingsResult = ImmutableOpenMap.of();
         Map<String, List<AliasMetadata>> aliasesResult = Map.of();
         Map<String, Settings> settings = Map.of();
         Map<String, Settings> defaultSettings = Map.of();
-        ProjectMetadata project = projectResolver.getProjectMetadata(state);
+        ProjectMetadata project = state.metadata();
         Map<String, String> dataStreams = project.findDataStreams(concreteIndices)
             .entrySet()
             .stream()

+ 0 - 82
server/src/main/java/org/elasticsearch/action/support/master/info/ClusterInfoRequest.java

@@ -1,82 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the "Elastic License
- * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
- * Public License v 1"; you may not use this file except in compliance with, at
- * your election, the "Elastic License 2.0", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-
-package org.elasticsearch.action.support.master.info;
-
-import org.elasticsearch.TransportVersions;
-import org.elasticsearch.action.IndicesRequest;
-import org.elasticsearch.action.support.IndicesOptions;
-import org.elasticsearch.action.support.master.MasterNodeReadRequest;
-import org.elasticsearch.common.Strings;
-import org.elasticsearch.common.io.stream.StreamInput;
-import org.elasticsearch.common.io.stream.StreamOutput;
-import org.elasticsearch.core.TimeValue;
-
-import java.io.IOException;
-
-public abstract class ClusterInfoRequest<Request extends ClusterInfoRequest<Request>> extends MasterNodeReadRequest<Request>
-    implements
-        IndicesRequest.Replaceable {
-
-    private String[] indices = Strings.EMPTY_ARRAY;
-
-    private IndicesOptions indicesOptions;
-
-    protected ClusterInfoRequest(TimeValue masterTimeout, IndicesOptions indicesOptions) {
-        super(masterTimeout);
-        this.indicesOptions = indicesOptions;
-    }
-
-    protected ClusterInfoRequest(StreamInput in) throws IOException {
-        super(in);
-        indices = in.readStringArray();
-        if (in.getTransportVersion().before(TransportVersions.V_8_0_0)) {
-            in.readStringArray();
-        }
-        indicesOptions = IndicesOptions.readIndicesOptions(in);
-    }
-
-    @Override
-    public void writeTo(StreamOutput out) throws IOException {
-        super.writeTo(out);
-        out.writeStringArray(indices);
-        if (out.getTransportVersion().before(TransportVersions.V_8_0_0)) {
-            out.writeStringArray(Strings.EMPTY_ARRAY);
-        }
-        indicesOptions.writeIndicesOptions(out);
-    }
-
-    @Override
-    @SuppressWarnings("unchecked")
-    public Request indices(String... indices) {
-        this.indices = indices;
-        return (Request) this;
-    }
-
-    @SuppressWarnings("unchecked")
-    public Request indicesOptions(IndicesOptions indicesOptions) {
-        this.indicesOptions = indicesOptions;
-        return (Request) this;
-    }
-
-    @Override
-    public String[] indices() {
-        return indices;
-    }
-
-    @Override
-    public IndicesOptions indicesOptions() {
-        return indicesOptions;
-    }
-
-    @Override
-    public boolean includeDataStreams() {
-        return true;
-    }
-}

+ 0 - 47
server/src/main/java/org/elasticsearch/action/support/master/info/ClusterInfoRequestBuilder.java

@@ -1,47 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the "Elastic License
- * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
- * Public License v 1"; you may not use this file except in compliance with, at
- * your election, the "Elastic License 2.0", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-package org.elasticsearch.action.support.master.info;
-
-import org.elasticsearch.action.ActionResponse;
-import org.elasticsearch.action.ActionType;
-import org.elasticsearch.action.support.IndicesOptions;
-import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder;
-import org.elasticsearch.client.internal.ElasticsearchClient;
-import org.elasticsearch.common.util.ArrayUtils;
-
-public abstract class ClusterInfoRequestBuilder<
-    Request extends ClusterInfoRequest<Request>,
-    Response extends ActionResponse,
-    Builder extends ClusterInfoRequestBuilder<Request, Response, Builder>> extends MasterNodeReadOperationRequestBuilder<
-        Request,
-        Response,
-        Builder> {
-
-    protected ClusterInfoRequestBuilder(ElasticsearchClient client, ActionType<Response> action, Request request) {
-        super(client, action, request);
-    }
-
-    @SuppressWarnings("unchecked")
-    public Builder setIndices(String... indices) {
-        request.indices(indices);
-        return (Builder) this;
-    }
-
-    @SuppressWarnings("unchecked")
-    public Builder addIndices(String... indices) {
-        request.indices(ArrayUtils.concat(request.indices(), indices));
-        return (Builder) this;
-    }
-
-    @SuppressWarnings("unchecked")
-    public Builder setIndicesOptions(IndicesOptions indicesOptions) {
-        request.indicesOptions(indicesOptions);
-        return (Builder) this;
-    }
-}

+ 0 - 89
server/src/main/java/org/elasticsearch/action/support/master/info/TransportClusterInfoAction.java

@@ -1,89 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the "Elastic License
- * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
- * Public License v 1"; you may not use this file except in compliance with, at
- * your election, the "Elastic License 2.0", the "GNU Affero General Public
- * License v3.0 only", or the "Server Side Public License, v 1".
- */
-package org.elasticsearch.action.support.master.info;
-
-import org.elasticsearch.action.ActionListener;
-import org.elasticsearch.action.ActionResponse;
-import org.elasticsearch.action.support.ActionFilters;
-import org.elasticsearch.action.support.master.TransportMasterNodeReadAction;
-import org.elasticsearch.cluster.ClusterState;
-import org.elasticsearch.cluster.block.ClusterBlockException;
-import org.elasticsearch.cluster.block.ClusterBlockLevel;
-import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
-import org.elasticsearch.cluster.metadata.ProjectId;
-import org.elasticsearch.cluster.metadata.ProjectMetadata;
-import org.elasticsearch.cluster.project.ProjectResolver;
-import org.elasticsearch.cluster.service.ClusterService;
-import org.elasticsearch.common.io.stream.Writeable;
-import org.elasticsearch.tasks.Task;
-import org.elasticsearch.threadpool.ThreadPool;
-import org.elasticsearch.transport.TransportService;
-
-public abstract class TransportClusterInfoAction<Request extends ClusterInfoRequest<Request>, Response extends ActionResponse> extends
-    TransportMasterNodeReadAction<Request, Response> {
-
-    protected final ProjectResolver projectResolver;
-    private final IndexNameExpressionResolver indexNameExpressionResolver;
-
-    public TransportClusterInfoAction(
-        String actionName,
-        TransportService transportService,
-        ClusterService clusterService,
-        ThreadPool threadPool,
-        ActionFilters actionFilters,
-        Writeable.Reader<Request> request,
-        IndexNameExpressionResolver indexNameExpressionResolver,
-        Writeable.Reader<Response> response,
-        ProjectResolver projectResolver
-    ) {
-        super(
-            actionName,
-            transportService,
-            clusterService,
-            threadPool,
-            actionFilters,
-            request,
-            response,
-            threadPool.executor(ThreadPool.Names.MANAGEMENT)
-        );
-        this.projectResolver = projectResolver;
-        this.indexNameExpressionResolver = indexNameExpressionResolver;
-    }
-
-    @Override
-    protected ClusterBlockException checkBlock(Request request, ClusterState state) {
-        final ProjectMetadata projectMetadata = projectResolver.getProjectMetadata(state);
-        return state.blocks()
-            .indicesBlockedException(
-                projectMetadata.id(),
-                ClusterBlockLevel.METADATA_READ,
-                indexNameExpressionResolver.concreteIndexNames(projectMetadata, request)
-            );
-    }
-
-    @Override
-    protected final void masterOperation(
-        Task task,
-        final Request request,
-        final ClusterState state,
-        final ActionListener<Response> listener
-    ) {
-        ProjectId projectId = projectResolver.getProjectId();
-        String[] concreteIndices = indexNameExpressionResolver.concreteIndexNames(state.metadata().getProject(projectId), request);
-        doMasterOperation(task, request, concreteIndices, state, listener);
-    }
-
-    protected abstract void doMasterOperation(
-        Task task,
-        Request request,
-        String[] concreteIndices,
-        ClusterState state,
-        ActionListener<Response> listener
-    );
-}

+ 3 - 3
server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java

@@ -16,6 +16,7 @@ import org.elasticsearch.common.Strings;
 import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.rest.BaseRestHandler;
 import org.elasticsearch.rest.RestRequest;
+import org.elasticsearch.rest.RestUtils;
 import org.elasticsearch.rest.Scope;
 import org.elasticsearch.rest.ServerlessScope;
 import org.elasticsearch.rest.action.RestCancellableNodeClient;
@@ -27,7 +28,6 @@ import java.util.Set;
 
 import static org.elasticsearch.rest.RestRequest.Method.GET;
 import static org.elasticsearch.rest.RestRequest.Method.HEAD;
-import static org.elasticsearch.rest.RestUtils.getMasterNodeTimeout;
 
 /**
  * The REST handler for get index and head index APIs.
@@ -48,10 +48,10 @@ public class RestGetIndicesAction extends BaseRestHandler {
     @Override
     public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
         String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
-        final GetIndexRequest getIndexRequest = new GetIndexRequest(getMasterNodeTimeout(request));
+        final GetIndexRequest getIndexRequest = new GetIndexRequest(RestUtils.getMasterNodeTimeout(request));
         getIndexRequest.indices(indices);
         getIndexRequest.indicesOptions(IndicesOptions.fromRequest(request, getIndexRequest.indicesOptions()));
-        getIndexRequest.local(request.paramAsBoolean("local", getIndexRequest.local()));
+        RestUtils.consumeDeprecatedLocalParameter(request);
         getIndexRequest.humanReadable(request.paramAsBoolean("human", false));
         getIndexRequest.includeDefaults(request.paramAsBoolean("include_defaults", false));
         getIndexRequest.features(GetIndexRequest.Feature.fromRequest(request));

+ 8 - 9
server/src/test/java/org/elasticsearch/action/admin/indices/get/GetIndexActionTests.java

@@ -14,10 +14,10 @@ import org.elasticsearch.action.IndicesRequest;
 import org.elasticsearch.action.support.ActionFilters;
 import org.elasticsearch.action.support.ActionTestUtils;
 import org.elasticsearch.action.support.replication.ClusterStateCreationUtils;
-import org.elasticsearch.cluster.ClusterState;
+import org.elasticsearch.cluster.ProjectState;
 import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
+import org.elasticsearch.cluster.metadata.ProjectId;
 import org.elasticsearch.cluster.metadata.ProjectMetadata;
-import org.elasticsearch.cluster.project.DefaultProjectResolver;
 import org.elasticsearch.cluster.project.TestProjectResolvers;
 import org.elasticsearch.cluster.service.ClusterService;
 import org.elasticsearch.common.settings.IndexScopedSettings;
@@ -124,20 +124,19 @@ public class GetIndexActionTests extends ESSingleNodeTestCase {
                 new GetIndexActionTests.Resolver(),
                 indicesService,
                 IndexScopedSettings.DEFAULT_SCOPED_SETTINGS,
-                DefaultProjectResolver.INSTANCE
+                TestProjectResolvers.DEFAULT_PROJECT_ONLY
             );
         }
 
         @Override
-        protected void doMasterOperation(
+        protected void localClusterStateOperation(
             Task task,
             GetIndexRequest request,
-            String[] concreteIndices,
-            ClusterState state,
+            ProjectState state,
             ActionListener<GetIndexResponse> listener
-        ) {
-            ClusterState stateWithIndex = ClusterStateCreationUtils.state(indexName, 1, 1);
-            super.doMasterOperation(task, request, concreteIndices, stateWithIndex, listener);
+        ) throws Exception {
+            ProjectState stateWithIndex = ClusterStateCreationUtils.state(indexName, 1, 1).projectState(ProjectId.DEFAULT);
+            super.localClusterStateOperation(task, request, stateWithIndex, listener);
         }
     }
 

+ 2 - 14
server/src/test/java/org/elasticsearch/action/admin/indices/get/GetIndexResponseTests.java

@@ -14,12 +14,11 @@ import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponseTests;
 import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponseTests;
 import org.elasticsearch.cluster.metadata.AliasMetadata;
 import org.elasticsearch.cluster.metadata.MappingMetadata;
-import org.elasticsearch.common.io.stream.Writeable;
 import org.elasticsearch.common.settings.IndexScopedSettings;
 import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.index.RandomCreateIndexGenerator;
 import org.elasticsearch.test.AbstractChunkedSerializingTestCase;
-import org.elasticsearch.test.AbstractWireSerializingTestCase;
+import org.elasticsearch.test.ESTestCase;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -30,14 +29,8 @@ import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 
-public class GetIndexResponseTests extends AbstractWireSerializingTestCase<GetIndexResponse> {
+public class GetIndexResponseTests extends ESTestCase {
 
-    @Override
-    protected Writeable.Reader<GetIndexResponse> instanceReader() {
-        return GetIndexResponse::new;
-    }
-
-    @Override
     protected GetIndexResponse createTestInstance() {
         String[] indices = generateRandomStringArray(5, 5, false, false);
         Map<String, MappingMetadata> mappings = new HashMap<>();
@@ -77,11 +70,6 @@ public class GetIndexResponseTests extends AbstractWireSerializingTestCase<GetIn
         return new GetIndexResponse(indices, mappings, aliases, settings, defaultSettings, dataStreams);
     }
 
-    @Override
-    protected GetIndexResponse mutateInstance(GetIndexResponse instance) {
-        return null;// TODO implement https://github.com/elastic/elasticsearch/issues/25929
-    }
-
     public void testChunking() throws IOException {
         AbstractChunkedSerializingTestCase.assertChunkCount(createTestInstance(), response -> response.getIndices().length + 2);
     }

+ 1 - 2
x-pack/plugin/ql/src/main/java/org/elasticsearch/xpack/ql/index/IndexResolver.java

@@ -263,8 +263,7 @@ public class IndexResolver {
     ) {
         if (retrieveIndices || retrieveFrozenIndices) {
             if (clusterIsLocal(clusterWildcard)) { // resolve local indices
-                GetIndexRequest indexRequest = new GetIndexRequest(MasterNodeRequest.INFINITE_MASTER_NODE_TIMEOUT).local(true)
-                    .indices(indexWildcards)
+                GetIndexRequest indexRequest = new GetIndexRequest(MasterNodeRequest.INFINITE_MASTER_NODE_TIMEOUT).indices(indexWildcards)
                     .features(Feature.SETTINGS)
                     .includeDefaults(false)
                     .indicesOptions(INDICES_ONLY_OPTIONS);