From ba0997383e69a4cc06bc07771e4f2dad6ebadf42 Mon Sep 17 00:00:00 2001 From: Shivansh Arora Date: Thu, 5 Sep 2024 18:49:48 +0530 Subject: [PATCH] missed while merging Signed-off-by: Shivansh Arora --- .../org/opensearch/index/IndexSettings.java | 8 -- .../opensearch/search/SearchServiceTests.java | 99 ------------------- 2 files changed, 107 deletions(-) diff --git a/server/src/main/java/org/opensearch/index/IndexSettings.java b/server/src/main/java/org/opensearch/index/IndexSettings.java index 991a5dbaf758f..554e99764c1a1 100644 --- a/server/src/main/java/org/opensearch/index/IndexSettings.java +++ b/server/src/main/java/org/opensearch/index/IndexSettings.java @@ -732,14 +732,6 @@ public static IndexMergePolicy fromString(String text) { Property.IndexScope ); - public static final Setting INDEX_CONCURRENT_SEGMENT_SEARCH_MAX_SLICE_COUNT = Setting.intSetting( - "index.search.concurrent.max_slice_count", - CONCURRENT_SEGMENT_SEARCH_TARGET_MAX_SLICE_COUNT_DEFAULT_VALUE, - CONCURRENT_SEGMENT_SEARCH_TARGET_MAX_SLICE_COUNT_DEFAULT_VALUE, - Property.Dynamic, - Property.IndexScope - ); - public static final Setting INDEX_DOC_ID_FUZZY_SET_ENABLED_SETTING = Setting.boolSetting( "index.optimize_doc_id_lookup.fuzzy_set.enabled", false, diff --git a/server/src/test/java/org/opensearch/search/SearchServiceTests.java b/server/src/test/java/org/opensearch/search/SearchServiceTests.java index fd155b7c7609e..31084049a2402 100644 --- a/server/src/test/java/org/opensearch/search/SearchServiceTests.java +++ b/server/src/test/java/org/opensearch/search/SearchServiceTests.java @@ -1696,105 +1696,6 @@ public void testConcurrentSegmentSearchSliceCount() throws IOException { .get(); } - /** - * Tests that the slice count is calculated correctly when concurrent search is enabled - * If concurrent search enabled - - * pick index level slice count setting if index level setting is set - * else pick default cluster level slice count setting - * @throws IOException - */ - public void testConcurrentSegmentSearchSliceCount() throws IOException { - - String index = randomAlphaOfLengthBetween(5, 10).toLowerCase(Locale.ROOT); - IndexService indexService = createIndex(index); - final SearchService service = getInstanceFromNode(SearchService.class); - ClusterService clusterService = getInstanceFromNode(ClusterService.class); - ShardId shardId = new ShardId(indexService.index(), 0); - long nowInMillis = System.currentTimeMillis(); - String clusterAlias = randomBoolean() ? null : randomAlphaOfLengthBetween(3, 10); - SearchRequest searchRequest = new SearchRequest(); - searchRequest.allowPartialSearchResults(randomBoolean()); - ShardSearchRequest request = new ShardSearchRequest( - OriginalIndices.NONE, - searchRequest, - shardId, - indexService.numberOfShards(), - AliasFilter.EMPTY, - 1f, - nowInMillis, - clusterAlias, - Strings.EMPTY_ARRAY - ); - // enable concurrent search - client().admin() - .cluster() - .prepareUpdateSettings() - .setTransientSettings(Settings.builder().put(SearchService.CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), true)) - .get(); - - Integer[][] scenarios = { - // cluster setting, index setting, expected slice count - // expected value null will pick up default value from settings - { null, null, clusterService.getClusterSettings().get(SearchService.CONCURRENT_SEGMENT_SEARCH_TARGET_MAX_SLICE_COUNT_SETTING) }, - { 4, null, 4 }, - { null, 3, 3 }, - { 4, 3, 3 }, }; - - for (Integer[] sliceCounts : scenarios) { - Integer clusterSliceCount = sliceCounts[0]; - Integer indexSliceCount = sliceCounts[1]; - Integer targetSliceCount = sliceCounts[2]; - - if (clusterSliceCount != null) { - client().admin() - .cluster() - .prepareUpdateSettings() - .setTransientSettings( - Settings.builder() - .put(SearchService.CONCURRENT_SEGMENT_SEARCH_TARGET_MAX_SLICE_COUNT_SETTING.getKey(), clusterSliceCount) - ) - .get(); - } else { - client().admin() - .cluster() - .prepareUpdateSettings() - .setTransientSettings( - Settings.builder().putNull(SearchService.CONCURRENT_SEGMENT_SEARCH_TARGET_MAX_SLICE_COUNT_SETTING.getKey()) - ) - .get(); - } - if (indexSliceCount != null) { - client().admin() - .indices() - .prepareUpdateSettings(index) - .setSettings( - Settings.builder().put(IndexSettings.INDEX_CONCURRENT_SEGMENT_SEARCH_MAX_SLICE_COUNT.getKey(), indexSliceCount) - ) - .get(); - } else { - client().admin() - .indices() - .prepareUpdateSettings(index) - .setSettings(Settings.builder().putNull(IndexSettings.INDEX_CONCURRENT_SEGMENT_SEARCH_MAX_SLICE_COUNT.getKey())) - .get(); - } - - try (DefaultSearchContext searchContext = service.createSearchContext(request, new TimeValue(System.currentTimeMillis()))) { - searchContext.evaluateRequestShouldUseConcurrentSearch(); - assertEquals(targetSliceCount.intValue(), searchContext.getTargetMaxSliceCount()); - } - } - // cleanup - client().admin() - .cluster() - .prepareUpdateSettings() - .setTransientSettings( - Settings.builder() - .putNull(SearchService.CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey()) - .putNull(SearchService.CONCURRENT_SEGMENT_SEARCH_TARGET_MAX_SLICE_COUNT_SETTING.getKey()) - ) - .get(); - } /** * Test that the Search Context for concurrent segment search enabled is set correctly at the time of construction.