Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make BaseNodesRequest#writeTo final #109783

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<NodesHotThreadsRequest> {

final HotThreads.RequestOptions requestOptions;
Expand Down Expand Up @@ -61,9 +57,4 @@ public TimeValue interval() {
public int snapshots() {
return requestOptions.snapshots();
}

@Override
public void writeTo(StreamOutput out) throws IOException {
TransportAction.localOnly();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -27,12 +24,6 @@ public PrevalidateShardPathRequest(Set<ShardId> 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<ShardId> getShardIds() {
return shardIds;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<NodesUsageRequest> {

Expand Down Expand Up @@ -73,9 +69,4 @@ public NodesUsageRequest aggregations(boolean aggregations) {
this.aggregations = aggregations;
return this;
}

@Override
public void writeTo(StreamOutput out) throws IOException {
TransportAction.localOnly();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<NodeSnapshotStatus> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -34,10 +31,4 @@ public ClusterStatsRequest(String... nodesIds) {
public Task createTask(long id, String type, String action, TaskId parentTaskId, Map<String, String> headers) {
return new CancellableTask(id, type, action, "", parentTaskId, headers);
}

@Override
public void writeTo(StreamOutput out) throws IOException {
TransportAction.localOnly();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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<FindDanglingIndexRequest> {
private final String indexUUID;
Expand All @@ -31,9 +27,4 @@ public String getIndexUUID() {
public String toString() {
return "FindDanglingIndicesRequest{indexUUID='" + indexUUID + "'}";
}

@Override
public void writeTo(StreamOutput out) throws IOException {
TransportAction.localOnly();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<ListDanglingIndicesRequest> {
/**
Expand All @@ -39,9 +35,4 @@ public String getIndexUUID() {
public String toString() {
return "ListDanglingIndicesRequest{indexUUID='" + indexUUID + "'}";
}

@Override
public void writeTo(StreamOutput out) throws IOException {
TransportAction.localOnly();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<NodeGatewayStartedShards> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<NodeStoreFilesMetadata> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 + "]";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 + "]";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 + "]";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,6 @@ public NodesRequest() {
public Task createTask(long id, String type, String action, TaskId parentTaskId, Map<String, String> 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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
Loading