Skip to content

Commit

Permalink
missed while merging
Browse files Browse the repository at this point in the history
Signed-off-by: Shivansh Arora <hishiv@amazon.com>
  • Loading branch information
shiv0408 committed Sep 5, 2024
1 parent 2cdf7c8 commit ba09973
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 107 deletions.
8 changes: 0 additions & 8 deletions server/src/main/java/org/opensearch/index/IndexSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -732,14 +732,6 @@ public static IndexMergePolicy fromString(String text) {
Property.IndexScope
);

public static final Setting<Integer> 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<Boolean> INDEX_DOC_ID_FUZZY_SET_ENABLED_SETTING = Setting.boolSetting(
"index.optimize_doc_id_lookup.fuzzy_set.enabled",
false,
Expand Down
99 changes: 0 additions & 99 deletions server/src/test/java/org/opensearch/search/SearchServiceTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit ba09973

Please sign in to comment.