Skip to content

Commit c002664

Browse files
authored
Fix AdaptiveSelectionStats serialization bug (#28718)
The AdaptiveSelectionStats object serializes the clientOutgoingConnections map that's concurrently updated in SearchTransportService. Serializing the map consists of first writing the size of the map and then serializing the entries. If the number of entries changes while the map is being serialized, the size and number of entries go out of sync. The deserialization routine expects those to be in sync though. Closes #28713
1 parent df07943 commit c002664

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

server/src/main/java/org/elasticsearch/action/search/SearchTransportService.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,6 @@ public SearchTransportService(Settings settings, TransportService transportServi
9595
this.responseWrapper = responseWrapper;
9696
}
9797

98-
public Map<String, Long> getClientConnections() {
99-
return Collections.unmodifiableMap(clientConnections);
100-
}
101-
10298
public void sendFreeContext(Transport.Connection connection, final long contextId, OriginalIndices originalIndices) {
10399
transportService.sendRequest(connection, FREE_CONTEXT_ACTION_NAME, new SearchFreeContextRequest(originalIndices, contextId),
104100
TransportRequestOptions.EMPTY, new ActionListenerResponseHandler<>(new ActionListener<SearchFreeContextResponse>() {

server/src/main/java/org/elasticsearch/node/NodeService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public NodeStats stats(CommonStatsFlags indices, boolean os, boolean process, bo
121121
script ? scriptService.stats() : null,
122122
discoveryStats ? discovery.stats() : null,
123123
ingest ? ingestService.getPipelineExecutionService().stats() : null,
124-
adaptiveSelection ? responseCollectorService.getAdaptiveStats(searchTransportService.getClientConnections()) : null
124+
adaptiveSelection ? responseCollectorService.getAdaptiveStats(searchTransportService.getPendingSearchRequests()) : null
125125
);
126126
}
127127

0 commit comments

Comments
 (0)