浏览代码

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
Yannick Welsch 7 年之前
父节点
当前提交
c0026648f0

+ 0 - 4
server/src/main/java/org/elasticsearch/action/search/SearchTransportService.java

@@ -95,10 +95,6 @@ public class SearchTransportService extends AbstractComponent {
         this.responseWrapper = responseWrapper;
         this.responseWrapper = responseWrapper;
     }
     }
 
 
-    public Map<String, Long> getClientConnections() {
-        return Collections.unmodifiableMap(clientConnections);
-    }
-
     public void sendFreeContext(Transport.Connection connection, final long contextId, OriginalIndices originalIndices) {
     public void sendFreeContext(Transport.Connection connection, final long contextId, OriginalIndices originalIndices) {
         transportService.sendRequest(connection, FREE_CONTEXT_ACTION_NAME, new SearchFreeContextRequest(originalIndices, contextId),
         transportService.sendRequest(connection, FREE_CONTEXT_ACTION_NAME, new SearchFreeContextRequest(originalIndices, contextId),
             TransportRequestOptions.EMPTY, new ActionListenerResponseHandler<>(new ActionListener<SearchFreeContextResponse>() {
             TransportRequestOptions.EMPTY, new ActionListenerResponseHandler<>(new ActionListener<SearchFreeContextResponse>() {

+ 1 - 1
server/src/main/java/org/elasticsearch/node/NodeService.java

@@ -121,7 +121,7 @@ public class NodeService extends AbstractComponent implements Closeable {
                 script ? scriptService.stats() : null,
                 script ? scriptService.stats() : null,
                 discoveryStats ? discovery.stats() : null,
                 discoveryStats ? discovery.stats() : null,
                 ingest ? ingestService.getPipelineExecutionService().stats() : null,
                 ingest ? ingestService.getPipelineExecutionService().stats() : null,
-                adaptiveSelection ? responseCollectorService.getAdaptiveStats(searchTransportService.getClientConnections()) : null
+                adaptiveSelection ? responseCollectorService.getAdaptiveStats(searchTransportService.getPendingSearchRequests()) : null
         );
         );
     }
     }