Remove remoteAddress field from TransportResponse (#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 https://github.com/elastic/elasticsearch/pull/120010
This commit is contained in:
Armin Braun 2025-03-16 19:54:29 +01:00 committed by GitHub
parent 6b6fc8028d
commit 4c1c51e870
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
201 changed files with 20 additions and 263 deletions

View file

@ -97,7 +97,6 @@ public class GetAnalyticsCollectionAction {
public static final ParseField EVENT_DATA_STREAM_NAME_FIELD = new ParseField("name");
public Response(StreamInput in) throws IOException {
super(in);
this.collections = in.readCollectionAsList(AnalyticsCollection::new);
}

View file

@ -24,7 +24,6 @@ public class ConnectorCreateActionResponse extends ActionResponse implements ToX
private final DocWriteResponse.Result result;
public ConnectorCreateActionResponse(StreamInput in) throws IOException {
super(in);
this.id = in.readString();
this.result = DocWriteResponse.Result.readFrom(in);
}

View file

@ -28,7 +28,6 @@ public class ConnectorUpdateActionResponse extends ActionResponse implements ToX
final DocWriteResponse.Result result;
public ConnectorUpdateActionResponse(StreamInput in) throws IOException {
super(in);
result = DocWriteResponse.Result.readFrom(in);
}

View file

@ -122,7 +122,6 @@ public class GetConnectorAction {
}
public Response(StreamInput in) throws IOException {
super(in);
this.connector = new ConnectorSearchResult(in);
}

View file

@ -184,7 +184,6 @@ public class ListConnectorAction {
final QueryPage<ConnectorSearchResult> queryPage;
public Response(StreamInput in) throws IOException {
super(in);
this.queryPage = new QueryPage<>(in, ConnectorSearchResult::new);
}

View file

@ -25,7 +25,6 @@ public class DeleteConnectorSecretResponse extends ActionResponse implements ToX
}
public DeleteConnectorSecretResponse(StreamInput in) throws IOException {
super(in);
this.deleted = in.readBoolean();
}

View file

@ -23,7 +23,6 @@ public class GetConnectorSecretResponse extends ActionResponse implements ToXCon
private final String value;
public GetConnectorSecretResponse(StreamInput in) throws IOException {
super(in);
id = in.readString();
value = in.readString();
}

View file

@ -26,7 +26,6 @@ public class PostConnectorSecretResponse extends ActionResponse implements ToXCo
}
public PostConnectorSecretResponse(StreamInput in) throws IOException {
super(in);
this.id = in.readString();
}

View file

@ -27,7 +27,6 @@ public class PutConnectorSecretResponse extends ActionResponse implements ToXCon
}
public PutConnectorSecretResponse(StreamInput in) throws IOException {
super(in);
result = DocWriteResponse.Result.readFrom(in);
}

View file

@ -116,7 +116,6 @@ public class GetConnectorSyncJobAction {
}
public Response(StreamInput in) throws IOException {
super(in);
this.connectorSyncJob = new ConnectorSyncJobSearchResult(in);
}

View file

@ -171,7 +171,6 @@ public class ListConnectorSyncJobsAction {
final QueryPage<ConnectorSyncJobSearchResult> queryPage;
public Response(StreamInput in) throws IOException {
super(in);
this.queryPage = new QueryPage<>(in, ConnectorSyncJobSearchResult::new);
}

View file

@ -146,7 +146,6 @@ public class PostConnectorSyncJobAction {
private final String id;
public Response(StreamInput in) throws IOException {
super(in);
this.id = in.readString();
}

View file

@ -126,7 +126,6 @@ public class GetQueryRuleAction {
private final QueryRule queryRule;
public Response(StreamInput in) throws IOException {
super(in);
this.queryRule = new QueryRule(in);
}

View file

@ -115,7 +115,6 @@ public class GetQueryRulesetAction {
private final QueryRuleset queryRuleset;
public Response(StreamInput in) throws IOException {
super(in);
this.queryRuleset = new QueryRuleset(in);
}

View file

@ -107,7 +107,6 @@ public class ListQueryRulesetsAction {
final QueryPage<QueryRulesetListItem> queryPage;
public Response(StreamInput in) throws IOException {
super(in);
this.queryPage = new QueryPage<>(in, QueryRulesetListItem::new);
}

View file

@ -151,7 +151,6 @@ public class PutQueryRuleAction {
final DocWriteResponse.Result result;
public Response(StreamInput in) throws IOException {
super(in);
result = DocWriteResponse.Result.readFrom(in);
}

View file

@ -136,7 +136,6 @@ public class PutQueryRulesetAction {
final DocWriteResponse.Result result;
public Response(StreamInput in) throws IOException {
super(in);
result = DocWriteResponse.Result.readFrom(in);
}

View file

@ -150,7 +150,6 @@ public class TestQueryRulesetAction {
private static final ParseField MATCHED_RULES_FIELD = new ParseField("matched_rules");
public Response(StreamInput in) throws IOException {
super(in);
this.totalMatchedRules = in.readVInt();
this.matchedRules = in.readCollectionAsList(MatchedRule::new);
}

View file

@ -109,7 +109,6 @@ public class GetSearchApplicationAction {
private final SearchApplication searchApp;
public Response(StreamInput in) throws IOException {
super(in);
this.searchApp = new SearchApplication(in);
}

View file

@ -127,7 +127,6 @@ public class ListSearchApplicationAction {
final QueryPage<SearchApplicationListItem> queryPage;
public Response(StreamInput in) throws IOException {
super(in);
this.queryPage = new QueryPage<>(in, SearchApplicationListItem::new);
}

View file

@ -135,7 +135,6 @@ public class PutSearchApplicationAction {
final DocWriteResponse.Result result;
public Response(StreamInput in) throws IOException {
super(in);
result = DocWriteResponse.Result.readFrom(in);
}

View file

@ -31,7 +31,6 @@ public class RenderSearchApplicationQueryAction {
private final SearchSourceBuilder searchSourceBuilder;
public Response(StreamInput in) throws IOException {
super(in);
this.searchSourceBuilder = new SearchSourceBuilder(in);
}