Skip to content

Commit df65022

Browse files
original-brownbearomricohenn
authored andcommitted
Remove remoteAddress field from TransportResponse (elastic#120016)
This field is only used (by security) for requests, having it in responses is redundant. Also, we have a couple of responses that are singletons/quasi-enums where setting the value needlessly might introduce some strange contention even though it's a plain store. This isn't just a cosmetic change. It makes it clear at compile time that each response instance is exclusively defined by the bytes that it is read from. This makes it easier to reason about the validity of suggested optimizations like elastic#120010
1 parent 677113e commit df65022

File tree

201 files changed

+20
-263
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

201 files changed

+20
-263
lines changed

modules/data-streams/src/main/java/org/elasticsearch/datastreams/lifecycle/action/GetDataStreamLifecycleStatsAction.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ public Response(@Nullable Long runDuration, @Nullable Long timeBetweenStarts, Li
6767
}
6868

6969
public Response(StreamInput in) throws IOException {
70-
super(in);
7170
this.runDuration = in.readOptionalVLong();
7271
this.timeBetweenStarts = in.readOptionalVLong();
7372
this.dataStreamStats = in.readCollectionAsImmutableList(DataStreamStats::read);

modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/GrokProcessorGetAction.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ public static class Response extends ActionResponse implements ToXContentObject
9696
}
9797

9898
Response(StreamInput in) throws IOException {
99-
super(in);
10099
grokPatterns = in.readMap(StreamInput::readString);
101100
}
102101

modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessExecuteAction.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,6 @@ public static class Response extends ActionResponse implements ToXContentObject
463463
}
464464

465465
Response(StreamInput in) throws IOException {
466-
super(in);
467466
result = in.readGenericValue();
468467
}
469468

modules/rank-eval/src/main/java/org/elasticsearch/index/rankeval/RankEvalResponse.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public RankEvalResponse(double metricScore, Map<String, EvalQueryQuality> partia
4444
}
4545

4646
RankEvalResponse(StreamInput in) throws IOException {
47-
super(in);
4847
this.metricScore = in.readDouble();
4948
int partialResultSize = in.readVInt();
5049
this.details = Maps.newMapWithExpectedSize(partialResultSize);

server/src/internalClusterTest/java/org/elasticsearch/action/admin/cluster/node/tasks/CancellableTasksIT.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,9 +495,7 @@ public TestResponse() {
495495

496496
}
497497

498-
public TestResponse(StreamInput in) throws IOException {
499-
super(in);
500-
}
498+
public TestResponse(StreamInput in) {}
501499

502500
@Override
503501
public void writeTo(StreamOutput out) throws IOException {

server/src/internalClusterTest/java/org/elasticsearch/search/rank/MockedRequestActionBasedRerankerIT.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,6 @@ public TestRerankingActionResponse(List<Float> scores) {
197197
this.scores = scores;
198198
}
199199

200-
public TestRerankingActionResponse(StreamInput in) throws IOException {
201-
super(in);
202-
this.scores = in.readCollectionAsList(StreamInput::readFloat);
203-
}
204-
205200
@Override
206201
public void writeTo(StreamOutput out) throws IOException {
207202
out.writeCollection(scores, StreamOutput::writeFloat);

server/src/main/java/org/elasticsearch/action/ActionResponse.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,18 @@
99

1010
package org.elasticsearch.action;
1111

12-
import org.elasticsearch.common.io.stream.StreamInput;
1312
import org.elasticsearch.common.io.stream.StreamOutput;
1413
import org.elasticsearch.transport.TransportResponse;
1514
import org.elasticsearch.xcontent.ToXContentObject;
1615
import org.elasticsearch.xcontent.XContentBuilder;
1716

18-
import java.io.IOException;
19-
2017
/**
2118
* Base class for responses to action requests.
2219
*/
2320
public abstract class ActionResponse extends TransportResponse {
2421

2522
public ActionResponse() {}
2623

27-
public ActionResponse(StreamInput in) throws IOException {
28-
super(in);
29-
}
30-
3124
public static final class Empty extends ActionResponse implements ToXContentObject {
3225
public static final ActionResponse.Empty INSTANCE = new ActionResponse.Empty();
3326

server/src/main/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplainResponse.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ public class ClusterAllocationExplainResponse extends ActionResponse implements
2626
private final ClusterAllocationExplanation cae;
2727

2828
public ClusterAllocationExplainResponse(StreamInput in) throws IOException {
29-
super(in);
3029
this.cae = new ClusterAllocationExplanation(in);
3130
}
3231

server/src/main/java/org/elasticsearch/action/admin/cluster/allocation/TransportGetAllocationStatsAction.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ public Response(Map<String, NodeAllocationStats> nodeAllocationStats, DiskThresh
157157
}
158158

159159
public Response(StreamInput in) throws IOException {
160-
super(in);
161160
this.nodeAllocationStats = in.readImmutableMap(StreamInput::readString, NodeAllocationStats::new);
162161
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_15_0)) {
163162
this.diskThresholdSettings = in.readOptionalWriteable(DiskThresholdSettings::readFrom);

server/src/main/java/org/elasticsearch/action/admin/cluster/coordination/ClusterFormationInfoAction.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ public static class Response extends ActionResponse {
8181
private final ClusterFormationFailureHelper.ClusterFormationState clusterFormationState;
8282

8383
public Response(StreamInput in) throws IOException {
84-
super(in);
8584
clusterFormationState = new ClusterFormationFailureHelper.ClusterFormationState(in);
8685
}
8786

0 commit comments

Comments
 (0)