From 09e9d498bb1dd0ace3ffc729525f62d076b998cb Mon Sep 17 00:00:00 2001 From: Jay Deng Date: Wed, 1 Nov 2023 12:11:52 -0700 Subject: [PATCH] poc --- .../bucket/DiversifiedSamplerIT.java | 16 +++++++++------- .../search/internal/ContextIndexSearcher.java | 5 +++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/DiversifiedSamplerIT.java b/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/DiversifiedSamplerIT.java index 865dd670fbf68..b5c20b50fa3df 100644 --- a/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/DiversifiedSamplerIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/search/aggregations/bucket/DiversifiedSamplerIT.java @@ -33,6 +33,7 @@ import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; +import com.carrotsearch.randomizedtesting.annotations.Repeat; import org.opensearch.action.admin.indices.refresh.RefreshRequest; import org.opensearch.action.search.SearchResponse; import org.opensearch.action.search.SearchType; @@ -73,7 +74,7 @@ @OpenSearchIntegTestCase.SuiteScopeTestCase public class DiversifiedSamplerIT extends ParameterizedOpenSearchIntegTestCase { - public static final int NUM_SHARDS = 2; + public static final int NUM_SHARDS = 1; public DiversifiedSamplerIT(Settings dynamicSettings) { super(dynamicSettings); @@ -82,7 +83,7 @@ public DiversifiedSamplerIT(Settings dynamicSettings) { @ParametersFactory public static Collection parameters() { return Arrays.asList( - new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), false).build() }, + new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), true).build() }, new Object[] { Settings.builder().put(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING.getKey(), true).build() } ); } @@ -137,8 +138,9 @@ public void setupSuiteScopeCluster() throws Exception { .setId("" + i) .setSource("name", parts[2], "genre", parts[8], "price", Float.parseFloat(parts[3])) .get(); + client().admin().indices().refresh(new RefreshRequest("test")).get(); + client().admin().indices().refresh(new RefreshRequest("idx_unmapped_author")).get(); } - client().admin().indices().refresh(new RefreshRequest("test")).get(); } public void testIssue10719() throws Exception { @@ -221,10 +223,10 @@ public void testNestedDiversity() throws Exception { } public void testNestedSamples() throws Exception { - assumeFalse( - "Concurrent search case muted pending fix: https://github.com/opensearch-project/OpenSearch/issues/10046", - internalCluster().clusterService().getClusterSettings().get(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING) - ); +// assumeFalse( +// "Concurrent search case muted pending fix: https://github.com/opensearch-project/OpenSearch/issues/10046", +// internalCluster().clusterService().getClusterSettings().get(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING) +// ); // Test samples nested under samples int MAX_DOCS_PER_AUTHOR = 1; int MAX_DOCS_PER_GENRE = 2; diff --git a/server/src/main/java/org/opensearch/search/internal/ContextIndexSearcher.java b/server/src/main/java/org/opensearch/search/internal/ContextIndexSearcher.java index a520086de8051..9bc3dbf869bd7 100644 --- a/server/src/main/java/org/opensearch/search/internal/ContextIndexSearcher.java +++ b/server/src/main/java/org/opensearch/search/internal/ContextIndexSearcher.java @@ -537,6 +537,11 @@ LeafSlice[] slicesInternal(List leaves, int targetMaxSlice) { leafSlices = MaxTargetSliceSupplier.getSlices(leaves, targetMaxSlice); logger.debug("Slice count using max target slice supplier [{}]", leafSlices.length); } + logger.info("The length of the leaf slices is [{}]", leafSlices.length); +// if (leafSlices.length == 1) { +// logger.info("The length of the leaf slices is 1"); +// throw new RuntimeException("The length of the leaf slices is 1"); +// } return leafSlices; } }