From 5e191a0c201889ffa163809134a6bddbf7588b8b Mon Sep 17 00:00:00 2001 From: David Turner Date: Mon, 17 Jun 2024 06:50:22 +0100 Subject: [PATCH] Make `BaseNodesRequest#writeTo` final (#109783) Since #109682 these requests are never sent or received over the wire, so we can drop all their `writeTo` implementations and forbid new actions from going over the wire by making the base class `writeTo` method final. Closes #100878 --- .../ingest/geoip/stats/GeoIpStatsAction.java | 6 ------ .../node/hotthreads/NodesHotThreadsRequest.java | 9 --------- .../admin/cluster/node/info/NodesInfoRequest.java | 8 -------- .../reload/NodesReloadSecureSettingsRequest.java | 6 ------ .../node/shutdown/PrevalidateShardPathRequest.java | 9 --------- .../admin/cluster/node/stats/NodesStatsRequest.java | 8 -------- .../admin/cluster/node/usage/NodesUsageRequest.java | 9 --------- .../status/TransportNodesSnapshotsStatus.java | 6 ------ .../admin/cluster/stats/ClusterStatsRequest.java | 9 --------- .../dangling/find/FindDanglingIndexRequest.java | 9 --------- .../dangling/list/ListDanglingIndicesRequest.java | 9 --------- .../action/support/nodes/BaseNodesRequest.java | 12 +++++------- .../TransportNodesListGatewayStartedShards.java | 5 ----- .../health/stats/HealthApiStatsAction.java | 5 ----- .../store/TransportNodesListShardStoreMetadata.java | 5 ----- .../cluster/node/tasks/CancellableTasksTests.java | 6 ------ .../admin/cluster/node/tasks/TestTaskPlugin.java | 9 --------- .../node/tasks/TransportTasksActionTests.java | 6 ------ .../NodesDataTiersUsageTransportAction.java | 5 ----- .../action/GetInferenceDiagnosticsAction.java | 6 ------ .../core/ml/action/TrainedModelCacheInfoAction.java | 6 ------ .../security/action/ClearSecurityCacheRequest.java | 6 ------ .../privilege/ClearPrivilegesCacheRequest.java | 6 ------ .../action/realm/ClearRealmCacheRequest.java | 6 ------ .../security/action/role/ClearRolesCacheRequest.java | 6 ------ .../GetServiceAccountCredentialsNodesRequest.java | 6 ------ .../core/spatial/action/SpatialStatsAction.java | 6 ------ .../action/GetTransformNodeStatsAction.java | 6 ------ .../transport/actions/stats/WatcherStatsRequest.java | 6 ------ .../deprecation/NodesDeprecationCheckRequest.java | 7 ------- .../enrich/action/EnrichCoordinatorStatsAction.java | 5 ----- .../xpack/eql/plugin/EqlStatsRequest.java | 6 ------ .../xpack/esql/plugin/EsqlStatsRequest.java | 6 ------ .../ClearRepositoriesMeteringArchiveRequest.java | 7 ------- .../metering/action/RepositoriesMeteringRequest.java | 7 ------- ...TransportSearchableSnapshotCacheStoresAction.java | 5 ----- ...portSearchableSnapshotsNodeCachesStatsAction.java | 6 ------ .../xpack/sql/plugin/SqlStatsRequest.java | 6 ------ 38 files changed, 5 insertions(+), 251 deletions(-) diff --git a/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/stats/GeoIpStatsAction.java b/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/stats/GeoIpStatsAction.java index 2557e8c4682ac..c7a1337f20e59 100644 --- a/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/stats/GeoIpStatsAction.java +++ b/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/stats/GeoIpStatsAction.java @@ -11,7 +11,6 @@ import org.elasticsearch.TransportVersions; import org.elasticsearch.action.ActionType; import org.elasticsearch.action.FailedNodeException; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.action.support.nodes.BaseNodeResponse; import org.elasticsearch.action.support.nodes.BaseNodesRequest; import org.elasticsearch.action.support.nodes.BaseNodesResponse; @@ -66,11 +65,6 @@ public boolean equals(Object obj) { } return true; } - - @Override - public void writeTo(StreamOutput out) { - TransportAction.localOnly(); - } } public static class NodeRequest extends TransportRequest { diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/node/hotthreads/NodesHotThreadsRequest.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/node/hotthreads/NodesHotThreadsRequest.java index 51a5ce265114d..467d2561f364e 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/node/hotthreads/NodesHotThreadsRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/node/hotthreads/NodesHotThreadsRequest.java @@ -8,15 +8,11 @@ package org.elasticsearch.action.admin.cluster.node.hotthreads; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.action.support.nodes.BaseNodesRequest; import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.core.TimeValue; import org.elasticsearch.monitor.jvm.HotThreads; -import java.io.IOException; - public class NodesHotThreadsRequest extends BaseNodesRequest { final HotThreads.RequestOptions requestOptions; @@ -61,9 +57,4 @@ public TimeValue interval() { public int snapshots() { return requestOptions.snapshots(); } - - @Override - public void writeTo(StreamOutput out) throws IOException { - TransportAction.localOnly(); - } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoRequest.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoRequest.java index 0931796523ed7..cef9e880a8e70 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoRequest.java @@ -8,11 +8,8 @@ package org.elasticsearch.action.admin.cluster.node.info; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.action.support.nodes.BaseNodesRequest; -import org.elasticsearch.common.io.stream.StreamOutput; -import java.io.IOException; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; @@ -100,11 +97,6 @@ public NodesInfoRequest removeMetric(String metric) { return this; } - @Override - public void writeTo(StreamOutput out) throws IOException { - TransportAction.localOnly(); - } - public NodesInfoMetrics getNodesInfoMetrics() { return nodesInfoMetrics; } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/node/reload/NodesReloadSecureSettingsRequest.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/node/reload/NodesReloadSecureSettingsRequest.java index a83a09af642fa..de1fd48c47cc4 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/node/reload/NodesReloadSecureSettingsRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/node/reload/NodesReloadSecureSettingsRequest.java @@ -9,7 +9,6 @@ package org.elasticsearch.action.admin.cluster.node.reload; import org.elasticsearch.TransportVersions; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.action.support.nodes.BaseNodesRequest; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.Strings; @@ -57,11 +56,6 @@ boolean hasPassword() { return this.secureSettingsPassword != null && this.secureSettingsPassword.length() > 0; } - @Override - public void writeTo(StreamOutput out) throws IOException { - TransportAction.localOnly(); - } - @Override public void incRef() { refs.incRef(); diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/PrevalidateShardPathRequest.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/PrevalidateShardPathRequest.java index 7b636d766dbf2..b8070bef1e32b 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/PrevalidateShardPathRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/PrevalidateShardPathRequest.java @@ -8,12 +8,9 @@ package org.elasticsearch.action.admin.cluster.node.shutdown; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.action.support.nodes.BaseNodesRequest; -import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.index.shard.ShardId; -import java.io.IOException; import java.util.Arrays; import java.util.Objects; import java.util.Set; @@ -27,12 +24,6 @@ public PrevalidateShardPathRequest(Set shardIds, String... nodeIds) { this.shardIds = Set.copyOf(Objects.requireNonNull(shardIds)); } - @Override - public void writeTo(StreamOutput out) throws IOException { - super.writeTo(out); - TransportAction.localOnly(); - } - public Set getShardIds() { return shardIds; } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/NodesStatsRequest.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/NodesStatsRequest.java index 5f83c641a3f82..c0329db1c1110 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/NodesStatsRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/NodesStatsRequest.java @@ -9,15 +9,12 @@ package org.elasticsearch.action.admin.cluster.node.stats; import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.action.support.nodes.BaseNodesRequest; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.tasks.CancellableTask; import org.elasticsearch.tasks.Task; import org.elasticsearch.tasks.TaskId; -import java.io.IOException; import java.util.Arrays; import java.util.Map; import java.util.Set; @@ -172,11 +169,6 @@ public void setIncludeShardsStats(boolean includeShardsStats) { nodesStatsRequestParameters.setIncludeShardsStats(includeShardsStats); } - @Override - public void writeTo(StreamOutput out) throws IOException { - TransportAction.localOnly(); - } - public NodesStatsRequestParameters getNodesStatsRequestParameters() { return nodesStatsRequestParameters; } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/node/usage/NodesUsageRequest.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/node/usage/NodesUsageRequest.java index 5fcea26b1b286..31fd93685e2c6 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/node/usage/NodesUsageRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/node/usage/NodesUsageRequest.java @@ -8,11 +8,7 @@ package org.elasticsearch.action.admin.cluster.node.usage; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.action.support.nodes.BaseNodesRequest; -import org.elasticsearch.common.io.stream.StreamOutput; - -import java.io.IOException; public class NodesUsageRequest extends BaseNodesRequest { @@ -73,9 +69,4 @@ public NodesUsageRequest aggregations(boolean aggregations) { this.aggregations = aggregations; return this; } - - @Override - public void writeTo(StreamOutput out) throws IOException { - TransportAction.localOnly(); - } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/TransportNodesSnapshotsStatus.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/TransportNodesSnapshotsStatus.java index 202940dfe7f69..82f32d2472b97 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/TransportNodesSnapshotsStatus.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/TransportNodesSnapshotsStatus.java @@ -12,7 +12,6 @@ import org.elasticsearch.action.ActionType; import org.elasticsearch.action.FailedNodeException; import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.action.support.nodes.BaseNodeResponse; import org.elasticsearch.action.support.nodes.BaseNodesRequest; import org.elasticsearch.action.support.nodes.BaseNodesResponse; @@ -132,11 +131,6 @@ public Request snapshots(Snapshot[] snapshots) { this.snapshots = snapshots; return this; } - - @Override - public void writeTo(StreamOutput out) throws IOException { - TransportAction.localOnly(); - } } public static class NodesSnapshotStatus extends BaseNodesResponse { diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsRequest.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsRequest.java index 377e931604548..77652eeb7d94e 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsRequest.java @@ -8,14 +8,11 @@ package org.elasticsearch.action.admin.cluster.stats; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.action.support.nodes.BaseNodesRequest; -import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.tasks.CancellableTask; import org.elasticsearch.tasks.Task; import org.elasticsearch.tasks.TaskId; -import java.io.IOException; import java.util.Map; /** @@ -34,10 +31,4 @@ public ClusterStatsRequest(String... nodesIds) { public Task createTask(long id, String type, String action, TaskId parentTaskId, Map headers) { return new CancellableTask(id, type, action, "", parentTaskId, headers); } - - @Override - public void writeTo(StreamOutput out) throws IOException { - TransportAction.localOnly(); - } - } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/dangling/find/FindDanglingIndexRequest.java b/server/src/main/java/org/elasticsearch/action/admin/indices/dangling/find/FindDanglingIndexRequest.java index e0f699121de8c..1f6d6e65b9128 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/dangling/find/FindDanglingIndexRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/dangling/find/FindDanglingIndexRequest.java @@ -8,12 +8,8 @@ package org.elasticsearch.action.admin.indices.dangling.find; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.action.support.nodes.BaseNodesRequest; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.io.stream.StreamOutput; - -import java.io.IOException; public class FindDanglingIndexRequest extends BaseNodesRequest { private final String indexUUID; @@ -31,9 +27,4 @@ public String getIndexUUID() { public String toString() { return "FindDanglingIndicesRequest{indexUUID='" + indexUUID + "'}"; } - - @Override - public void writeTo(StreamOutput out) throws IOException { - TransportAction.localOnly(); - } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/dangling/list/ListDanglingIndicesRequest.java b/server/src/main/java/org/elasticsearch/action/admin/indices/dangling/list/ListDanglingIndicesRequest.java index f0eafe3d0bf8c..450c45bf0742c 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/dangling/list/ListDanglingIndicesRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/dangling/list/ListDanglingIndicesRequest.java @@ -8,12 +8,8 @@ package org.elasticsearch.action.admin.indices.dangling.list; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.action.support.nodes.BaseNodesRequest; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.io.stream.StreamOutput; - -import java.io.IOException; public class ListDanglingIndicesRequest extends BaseNodesRequest { /** @@ -39,9 +35,4 @@ public String getIndexUUID() { public String toString() { return "ListDanglingIndicesRequest{indexUUID='" + indexUUID + "'}"; } - - @Override - public void writeTo(StreamOutput out) throws IOException { - TransportAction.localOnly(); - } } diff --git a/server/src/main/java/org/elasticsearch/action/support/nodes/BaseNodesRequest.java b/server/src/main/java/org/elasticsearch/action/support/nodes/BaseNodesRequest.java index 1461be729dd29..79aaac5d2f73b 100644 --- a/server/src/main/java/org/elasticsearch/action/support/nodes/BaseNodesRequest.java +++ b/server/src/main/java/org/elasticsearch/action/support/nodes/BaseNodesRequest.java @@ -10,6 +10,7 @@ import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionRequestValidationException; +import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.io.stream.StreamOutput; @@ -81,12 +82,9 @@ public ActionRequestValidationException validate() { } @Override - public void writeTo(StreamOutput out) throws IOException { - // A bare `BaseNodesRequest` is never sent over the wire, but several implementations send the full top-level request to each node - // (wrapped up in another request). They shouldn't, but until we fix that we must keep this. See #100878. - super.writeTo(out); - out.writeStringArrayNullable(nodesIds); - out.writeOptionalArray(concreteNodes); - out.writeOptionalTimeValue(timeout); + public final void writeTo(StreamOutput out) throws IOException { + // `BaseNodesRequest` is rather heavyweight, especially all those `DiscoveryNodes` objects in larger clusters, and there is no need + // to send it out over the wire. Use a dedicated transport request just for the bits you need. + TransportAction.localOnly(); } } diff --git a/server/src/main/java/org/elasticsearch/gateway/TransportNodesListGatewayStartedShards.java b/server/src/main/java/org/elasticsearch/gateway/TransportNodesListGatewayStartedShards.java index 31d996500cd83..599517b481eeb 100644 --- a/server/src/main/java/org/elasticsearch/gateway/TransportNodesListGatewayStartedShards.java +++ b/server/src/main/java/org/elasticsearch/gateway/TransportNodesListGatewayStartedShards.java @@ -205,11 +205,6 @@ public ShardId shardId() { public String getCustomDataPath() { return customDataPath; } - - @Override - public void writeTo(StreamOutput out) throws IOException { - TransportAction.localOnly(); - } } public static class NodesGatewayStartedShards extends BaseNodesResponse { diff --git a/server/src/main/java/org/elasticsearch/health/stats/HealthApiStatsAction.java b/server/src/main/java/org/elasticsearch/health/stats/HealthApiStatsAction.java index 9833a5368f058..394e14a60d26e 100644 --- a/server/src/main/java/org/elasticsearch/health/stats/HealthApiStatsAction.java +++ b/server/src/main/java/org/elasticsearch/health/stats/HealthApiStatsAction.java @@ -44,11 +44,6 @@ public Request() { super((String[]) null); } - @Override - public void writeTo(StreamOutput out) throws IOException { - TransportAction.localOnly(); - } - @Override public String toString() { return "health_api_stats"; diff --git a/server/src/main/java/org/elasticsearch/indices/store/TransportNodesListShardStoreMetadata.java b/server/src/main/java/org/elasticsearch/indices/store/TransportNodesListShardStoreMetadata.java index 9e6d066d38c7c..532aca07e5513 100644 --- a/server/src/main/java/org/elasticsearch/indices/store/TransportNodesListShardStoreMetadata.java +++ b/server/src/main/java/org/elasticsearch/indices/store/TransportNodesListShardStoreMetadata.java @@ -301,11 +301,6 @@ public ShardId shardId() { public String getCustomDataPath() { return customDataPath; } - - @Override - public void writeTo(StreamOutput out) throws IOException { - TransportAction.localOnly(); - } } public static class NodesStoreFilesMetadata extends BaseNodesResponse { diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/node/tasks/CancellableTasksTests.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/node/tasks/CancellableTasksTests.java index 9883eec6896ce..e541fef65a0f9 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/cluster/node/tasks/CancellableTasksTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/cluster/node/tasks/CancellableTasksTests.java @@ -107,12 +107,6 @@ public CancellableNodesRequest(String requestName, String... nodesIds) { this.requestName = requestName; } - @Override - public void writeTo(StreamOutput out) throws IOException { - super.writeTo(out); - out.writeString(requestName); - } - @Override public String getDescription() { return "CancellableNodesRequest[" + requestName + "]"; diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/node/tasks/TestTaskPlugin.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/node/tasks/TestTaskPlugin.java index 6f345eb7dcdab..859ee68a7846d 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/cluster/node/tasks/TestTaskPlugin.java +++ b/server/src/test/java/org/elasticsearch/action/admin/cluster/node/tasks/TestTaskPlugin.java @@ -230,15 +230,6 @@ public boolean getShouldFail() { return shouldFail; } - @Override - public void writeTo(StreamOutput out) throws IOException { - super.writeTo(out); - out.writeString(requestName); - out.writeBoolean(shouldStoreResult); - out.writeBoolean(shouldBlock); - out.writeBoolean(shouldFail); - } - @Override public String getDescription() { return "NodesRequest[" + requestName + "]"; diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/node/tasks/TransportTasksActionTests.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/node/tasks/TransportTasksActionTests.java index 969ed50685bc2..ca885b081452b 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/cluster/node/tasks/TransportTasksActionTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/cluster/node/tasks/TransportTasksActionTests.java @@ -114,12 +114,6 @@ public NodesRequest(String requestName, String... nodesIds) { this.requestName = requestName; } - @Override - public void writeTo(StreamOutput out) throws IOException { - super.writeTo(out); - out.writeString(requestName); - } - @Override public String getDescription() { return "CancellableNodesRequest[" + requestName + "]"; diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/datatiers/NodesDataTiersUsageTransportAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/datatiers/NodesDataTiersUsageTransportAction.java index c20d97b7125a0..b89b73f58c9b2 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/datatiers/NodesDataTiersUsageTransportAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/datatiers/NodesDataTiersUsageTransportAction.java @@ -170,11 +170,6 @@ public NodesRequest() { public Task createTask(long id, String type, String action, TaskId parentTaskId, Map headers) { return new CancellableTask(id, type, action, "", parentTaskId, headers); } - - @Override - public void writeTo(StreamOutput out) throws IOException { - super.writeTo(out); - } } public static class NodeRequest extends TransportRequest { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/action/GetInferenceDiagnosticsAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/action/GetInferenceDiagnosticsAction.java index 00dcd56424016..ef7af21e5e133 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/action/GetInferenceDiagnosticsAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/action/GetInferenceDiagnosticsAction.java @@ -10,7 +10,6 @@ import org.apache.http.pool.PoolStats; import org.elasticsearch.action.ActionType; import org.elasticsearch.action.FailedNodeException; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.action.support.nodes.BaseNodeResponse; import org.elasticsearch.action.support.nodes.BaseNodesRequest; import org.elasticsearch.action.support.nodes.BaseNodesResponse; @@ -55,11 +54,6 @@ public int hashCode() { // The class doesn't have any members at the moment so return the same hash code return Objects.hash(NAME); } - - @Override - public void writeTo(StreamOutput out) { - TransportAction.localOnly(); - } } public static class NodeRequest extends TransportRequest { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/TrainedModelCacheInfoAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/TrainedModelCacheInfoAction.java index 8ee928ba641de..9815a0e80651a 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/TrainedModelCacheInfoAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/TrainedModelCacheInfoAction.java @@ -9,7 +9,6 @@ import org.elasticsearch.action.ActionType; import org.elasticsearch.action.FailedNodeException; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.action.support.nodes.BaseNodeResponse; import org.elasticsearch.action.support.nodes.BaseNodesRequest; import org.elasticsearch.action.support.nodes.BaseNodesResponse; @@ -40,11 +39,6 @@ public Request(DiscoveryNode... concreteNodes) { super(concreteNodes); } - @Override - public void writeTo(StreamOutput out) throws IOException { - TransportAction.localOnly(); - } - @Override public int hashCode() { return Arrays.hashCode(concreteNodes()); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/ClearSecurityCacheRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/ClearSecurityCacheRequest.java index 78ec5ddaa1ad5..e97670f20bfbc 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/ClearSecurityCacheRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/ClearSecurityCacheRequest.java @@ -7,7 +7,6 @@ package org.elasticsearch.xpack.core.security.action; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.action.support.nodes.BaseNodesRequest; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; @@ -42,11 +41,6 @@ public String[] keys() { return keys; } - @Override - public void writeTo(StreamOutput out) throws IOException { - TransportAction.localOnly(); - } - public static class Node extends TransportRequest { private String cacheName; private String[] keys; diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/privilege/ClearPrivilegesCacheRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/privilege/ClearPrivilegesCacheRequest.java index 540cc4b3c70cd..6857f43bda25e 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/privilege/ClearPrivilegesCacheRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/privilege/ClearPrivilegesCacheRequest.java @@ -7,7 +7,6 @@ package org.elasticsearch.xpack.core.security.action.privilege; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.action.support.nodes.BaseNodesRequest; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; @@ -42,11 +41,6 @@ public boolean clearRolesCache() { return clearRolesCache; } - @Override - public void writeTo(StreamOutput out) throws IOException { - TransportAction.localOnly(); - } - public static class Node extends TransportRequest { private String[] applicationNames; private boolean clearRolesCache; diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/realm/ClearRealmCacheRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/realm/ClearRealmCacheRequest.java index ceee6cea8481a..fe381fc09b74a 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/realm/ClearRealmCacheRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/realm/ClearRealmCacheRequest.java @@ -6,7 +6,6 @@ */ package org.elasticsearch.xpack.core.security.action.realm; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.action.support.nodes.BaseNodesRequest; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; @@ -73,11 +72,6 @@ public ClearRealmCacheRequest usernames(String... usernames) { return this; } - @Override - public void writeTo(StreamOutput out) throws IOException { - TransportAction.localOnly(); - } - public static class Node extends TransportRequest { private String[] realms; diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/role/ClearRolesCacheRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/role/ClearRolesCacheRequest.java index 0d06382a891da..74d3a2ac85c78 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/role/ClearRolesCacheRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/role/ClearRolesCacheRequest.java @@ -6,7 +6,6 @@ */ package org.elasticsearch.xpack.core.security.action.role; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.action.support.nodes.BaseNodesRequest; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; @@ -42,11 +41,6 @@ public String[] names() { return names; } - @Override - public void writeTo(StreamOutput out) throws IOException { - TransportAction.localOnly(); - } - public static class Node extends TransportRequest { private String[] names; diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/service/GetServiceAccountCredentialsNodesRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/service/GetServiceAccountCredentialsNodesRequest.java index a2ebb338c15f0..9431ea14097a2 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/service/GetServiceAccountCredentialsNodesRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/service/GetServiceAccountCredentialsNodesRequest.java @@ -7,7 +7,6 @@ package org.elasticsearch.xpack.core.security.action.service; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.action.support.nodes.BaseNodesRequest; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; @@ -30,11 +29,6 @@ public GetServiceAccountCredentialsNodesRequest(String namespace, String service this.serviceName = serviceName; } - @Override - public void writeTo(StreamOutput out) throws IOException { - TransportAction.localOnly(); - } - public static class Node extends TransportRequest { private final String namespace; diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/spatial/action/SpatialStatsAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/spatial/action/SpatialStatsAction.java index 117d613a20cd9..80698dcbe022c 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/spatial/action/SpatialStatsAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/spatial/action/SpatialStatsAction.java @@ -8,7 +8,6 @@ import org.elasticsearch.action.ActionType; import org.elasticsearch.action.FailedNodeException; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.action.support.nodes.BaseNodeResponse; import org.elasticsearch.action.support.nodes.BaseNodesRequest; import org.elasticsearch.action.support.nodes.BaseNodesResponse; @@ -75,11 +74,6 @@ public boolean equals(Object obj) { } return true; } - - @Override - public void writeTo(StreamOutput out) throws IOException { - TransportAction.localOnly(); - } } public static class NodeRequest extends TransportRequest { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/GetTransformNodeStatsAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/GetTransformNodeStatsAction.java index 6cadefbe206f0..2ae4593ed3baa 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/GetTransformNodeStatsAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/GetTransformNodeStatsAction.java @@ -42,15 +42,9 @@ private GetTransformNodeStatsAction() { } public static class NodesStatsRequest extends BaseNodesRequest { - public NodesStatsRequest() { super(Strings.EMPTY_ARRAY); } - - @Override - public void writeTo(StreamOutput out) throws IOException { - TransportAction.localOnly(); - } } public static class NodesStatsResponse extends BaseNodesResponse implements ToXContentObject { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/watcher/transport/actions/stats/WatcherStatsRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/watcher/transport/actions/stats/WatcherStatsRequest.java index ac55db16802d2..2162ec5c38cec 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/watcher/transport/actions/stats/WatcherStatsRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/watcher/transport/actions/stats/WatcherStatsRequest.java @@ -6,7 +6,6 @@ */ package org.elasticsearch.xpack.core.watcher.transport.actions.stats; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.action.support.nodes.BaseNodesRequest; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; @@ -51,11 +50,6 @@ public void includeStats(boolean includeStats) { this.includeStats = includeStats; } - @Override - public void writeTo(StreamOutput out) throws IOException { - TransportAction.localOnly(); - } - @Override public String toString() { return "watcher_stats"; diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodesDeprecationCheckRequest.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodesDeprecationCheckRequest.java index 63966985ece6f..ebe8f036c80a6 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodesDeprecationCheckRequest.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodesDeprecationCheckRequest.java @@ -7,9 +7,7 @@ package org.elasticsearch.xpack.deprecation; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.action.support.nodes.BaseNodesRequest; -import org.elasticsearch.common.io.stream.StreamOutput; import java.util.Arrays; import java.util.Objects; @@ -20,11 +18,6 @@ public NodesDeprecationCheckRequest(String... nodesIds) { super(nodesIds); } - @Override - public void writeTo(StreamOutput out) { - TransportAction.localOnly(); - } - @Override public int hashCode() { return Objects.hash((Object[]) this.nodesIds()); diff --git a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/action/EnrichCoordinatorStatsAction.java b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/action/EnrichCoordinatorStatsAction.java index f40f14059772e..be23bb1ab06c7 100644 --- a/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/action/EnrichCoordinatorStatsAction.java +++ b/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/action/EnrichCoordinatorStatsAction.java @@ -49,11 +49,6 @@ public static class Request extends BaseNodesRequest { public Request() { super(new String[0]); } - - @Override - public void writeTo(StreamOutput out) { - org.elasticsearch.action.support.TransportAction.localOnly(); - } } public static class NodeRequest extends TransportRequest { diff --git a/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/EqlStatsRequest.java b/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/EqlStatsRequest.java index 53e9e1d1a0137..56335be32de6c 100644 --- a/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/EqlStatsRequest.java +++ b/x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/EqlStatsRequest.java @@ -7,7 +7,6 @@ package org.elasticsearch.xpack.eql.plugin; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.action.support.nodes.BaseNodesRequest; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; @@ -34,11 +33,6 @@ public void includeStats(boolean includeStats) { this.includeStats = includeStats; } - @Override - public void writeTo(StreamOutput out) throws IOException { - TransportAction.localOnly(); - } - @Override public String toString() { return "eql_stats"; diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/EsqlStatsRequest.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/EsqlStatsRequest.java index 2a0a148459250..1637bcc335ad3 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/EsqlStatsRequest.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/EsqlStatsRequest.java @@ -7,7 +7,6 @@ package org.elasticsearch.xpack.esql.plugin; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.action.support.nodes.BaseNodesRequest; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; @@ -34,11 +33,6 @@ public void includeStats(boolean includeStats) { this.includeStats = includeStats; } - @Override - public void writeTo(StreamOutput out) throws IOException { - TransportAction.localOnly(); - } - @Override public String toString() { return "esql_stats"; diff --git a/x-pack/plugin/repositories-metering-api/src/main/java/org/elasticsearch/xpack/repositories/metering/action/ClearRepositoriesMeteringArchiveRequest.java b/x-pack/plugin/repositories-metering-api/src/main/java/org/elasticsearch/xpack/repositories/metering/action/ClearRepositoriesMeteringArchiveRequest.java index 752fadf11d58a..a08852f60736f 100644 --- a/x-pack/plugin/repositories-metering-api/src/main/java/org/elasticsearch/xpack/repositories/metering/action/ClearRepositoriesMeteringArchiveRequest.java +++ b/x-pack/plugin/repositories-metering-api/src/main/java/org/elasticsearch/xpack/repositories/metering/action/ClearRepositoriesMeteringArchiveRequest.java @@ -7,9 +7,7 @@ package org.elasticsearch.xpack.repositories.metering.action; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.action.support.nodes.BaseNodesRequest; -import org.elasticsearch.common.io.stream.StreamOutput; public final class ClearRepositoriesMeteringArchiveRequest extends BaseNodesRequest { private final long maxVersionToClear; @@ -19,11 +17,6 @@ public ClearRepositoriesMeteringArchiveRequest(long maxVersionToClear, String... this.maxVersionToClear = maxVersionToClear; } - @Override - public void writeTo(StreamOutput out) { - TransportAction.localOnly(); - } - public long getMaxVersionToClear() { return maxVersionToClear; } diff --git a/x-pack/plugin/repositories-metering-api/src/main/java/org/elasticsearch/xpack/repositories/metering/action/RepositoriesMeteringRequest.java b/x-pack/plugin/repositories-metering-api/src/main/java/org/elasticsearch/xpack/repositories/metering/action/RepositoriesMeteringRequest.java index 95c30d3833aa9..d311273dad76e 100644 --- a/x-pack/plugin/repositories-metering-api/src/main/java/org/elasticsearch/xpack/repositories/metering/action/RepositoriesMeteringRequest.java +++ b/x-pack/plugin/repositories-metering-api/src/main/java/org/elasticsearch/xpack/repositories/metering/action/RepositoriesMeteringRequest.java @@ -7,17 +7,10 @@ package org.elasticsearch.xpack.repositories.metering.action; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.action.support.nodes.BaseNodesRequest; -import org.elasticsearch.common.io.stream.StreamOutput; public final class RepositoriesMeteringRequest extends BaseNodesRequest { public RepositoriesMeteringRequest(String... nodesIds) { super(nodesIds); } - - @Override - public void writeTo(StreamOutput out) { - TransportAction.localOnly(); - } } diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/cache/TransportSearchableSnapshotCacheStoresAction.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/cache/TransportSearchableSnapshotCacheStoresAction.java index c0cec06fd6cf7..5e9ef177bdc6f 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/cache/TransportSearchableSnapshotCacheStoresAction.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/cache/TransportSearchableSnapshotCacheStoresAction.java @@ -104,11 +104,6 @@ public Request(SnapshotId snapshotId, ShardId shardId, DiscoveryNode[] nodes) { this.snapshotId = snapshotId; this.shardId = shardId; } - - @Override - public void writeTo(StreamOutput out) throws IOException { - TransportAction.localOnly(); - } } public static final class NodeRequest extends TransportRequest { diff --git a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/cache/TransportSearchableSnapshotsNodeCachesStatsAction.java b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/cache/TransportSearchableSnapshotsNodeCachesStatsAction.java index 9a40b39083139..31ed2cb98636c 100644 --- a/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/cache/TransportSearchableSnapshotsNodeCachesStatsAction.java +++ b/x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/action/cache/TransportSearchableSnapshotsNodeCachesStatsAction.java @@ -149,15 +149,9 @@ public void writeTo(StreamOutput out) throws IOException { } public static final class NodesRequest extends BaseNodesRequest { - public NodesRequest(String[] nodes) { super(nodes); } - - @Override - public void writeTo(StreamOutput out) { - TransportAction.localOnly(); - } } public static class NodeCachesStatsResponse extends BaseNodeResponse implements ToXContentFragment { diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlStatsRequest.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlStatsRequest.java index af3a82905f8ee..9f05152b63158 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlStatsRequest.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlStatsRequest.java @@ -7,7 +7,6 @@ package org.elasticsearch.xpack.sql.plugin; -import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.action.support.nodes.BaseNodesRequest; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; @@ -34,11 +33,6 @@ public void includeStats(boolean includeStats) { this.includeStats = includeStats; } - @Override - public void writeTo(StreamOutput out) throws IOException { - TransportAction.localOnly(); - } - @Override public String toString() { return "sql_stats";