From e8a8f4d6bab16bddb558bd43eec467e749419941 Mon Sep 17 00:00:00 2001 From: Harsha Vamsi Kalluri Date: Thu, 13 Jun 2024 19:59:28 +0000 Subject: [PATCH] Revert max_clause count from being volatile Signed-off-by: Harsha Vamsi Kalluri --- .../java/org/opensearch/search/SearchService.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/server/src/main/java/org/opensearch/search/SearchService.java b/server/src/main/java/org/opensearch/search/SearchService.java index 99fb6f8b9c544..31eac2e14d147 100644 --- a/server/src/main/java/org/opensearch/search/SearchService.java +++ b/server/src/main/java/org/opensearch/search/SearchService.java @@ -334,8 +334,6 @@ public class SearchService extends AbstractLifecycleComponent implements IndexEv private volatile int maxOpenPitContext; - private volatile int maxClauseCount; - private volatile boolean allowDerivedField; private final Cancellable keepAliveReaper; @@ -410,8 +408,8 @@ public SearchService( lowLevelCancellation = LOW_LEVEL_CANCELLATION_SETTING.get(settings); clusterService.getClusterSettings().addSettingsUpdateConsumer(LOW_LEVEL_CANCELLATION_SETTING, this::setLowLevelCancellation); - setMaxClauseCount(INDICES_MAX_CLAUSE_COUNT_SETTING.get(settings)); - clusterService.getClusterSettings().addSettingsUpdateConsumer(INDICES_MAX_CLAUSE_COUNT_SETTING, this::setMaxClauseCount); + IndexSearcher.setMaxClauseCount(INDICES_MAX_CLAUSE_COUNT_SETTING.get(settings)); + clusterService.getClusterSettings().addSettingsUpdateConsumer(INDICES_MAX_CLAUSE_COUNT_SETTING, IndexSearcher::setMaxClauseCount); allowDerivedField = CLUSTER_ALLOW_DERIVED_FIELD_SETTING.get(settings); clusterService.getClusterSettings().addSettingsUpdateConsumer(CLUSTER_ALLOW_DERIVED_FIELD_SETTING, this::setAllowDerivedField); @@ -495,11 +493,6 @@ private void setLowLevelCancellation(Boolean lowLevelCancellation) { this.lowLevelCancellation = lowLevelCancellation; } - private void setMaxClauseCount(int maxClauseCount) { - this.maxClauseCount = maxClauseCount; - IndexSearcher.setMaxClauseCount(maxClauseCount); - } - @Override public void afterIndexRemoved(Index index, IndexSettings indexSettings, IndexRemovalReason reason) { // once an index is removed due to deletion or closing, we can just clean up all the pending search context information