From fb0429ace1052723930d9587445d28a49e09d90c Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 27 Aug 2025 16:13:57 -0700 Subject: [PATCH] Handling concurrent segment search as part of fetch profiling Signed-off-by: Ankit Jain --- .../search/profile/fetch/FlatFetchProfileTree.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/src/main/java/org/opensearch/search/profile/fetch/FlatFetchProfileTree.java b/server/src/main/java/org/opensearch/search/profile/fetch/FlatFetchProfileTree.java index 9c9bef2a23e53..030f90193517a 100644 --- a/server/src/main/java/org/opensearch/search/profile/fetch/FlatFetchProfileTree.java +++ b/server/src/main/java/org/opensearch/search/profile/fetch/FlatFetchProfileTree.java @@ -12,11 +12,12 @@ import org.opensearch.search.profile.Timer; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeMap; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; /** * Simplified profiling tree for fetch phase operations. Each fetch phase is @@ -59,8 +60,8 @@ private static class Node { } private final List roots = new ArrayList<>(); - private final Map rootsMap = new HashMap<>(); - private final Map phaseMap = new HashMap<>(); + private final ConcurrentMap rootsMap = new ConcurrentHashMap<>(); + private final ConcurrentMap phaseMap = new ConcurrentHashMap<>(); /** Start profiling a new fetch phase and return its breakdown. */ FetchProfileBreakdown startFetchPhase(String element) {