Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable concurrent aggs for Diversified Sampler and Sampler aggs #11087

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Add instrumentation for indexing in transport bulk action and transport shard bulk action. ([#10273](https://github.com/opensearch-project/OpenSearch/pull/10273))
- [BUG] Disable sort optimization for HALF_FLOAT ([#10999](https://github.com/opensearch-project/OpenSearch/pull/10999))
- Performance improvement for MultiTerm Queries on Keyword fields ([#7057](https://github.com/opensearch-project/OpenSearch/issues/7057))
- Disable concurrent aggs for Diversified Sampler and Sampler aggs ([#11087](https://github.com/opensearch-project/OpenSearch/issues/11087))

### Deprecated

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@

import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;

import org.opensearch.action.admin.indices.refresh.RefreshRequest;
import org.opensearch.action.search.SearchResponse;
import org.opensearch.action.search.SearchType;
import org.opensearch.action.support.WriteRequest;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.util.FeatureFlags;
import org.opensearch.index.query.TermQueryBuilder;
Expand Down Expand Up @@ -132,13 +132,14 @@ public void setupSuiteScopeCluster() throws Exception {
client().prepareIndex("test")
.setId("" + i)
.setSource("author", parts[5], "name", parts[2], "genre", parts[8], "price", Float.parseFloat(parts[3]))
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
jed326 marked this conversation as resolved.
Show resolved Hide resolved
.get();
client().prepareIndex("idx_unmapped_author")
.setId("" + i)
.setSource("name", parts[2], "genre", parts[8], "price", Float.parseFloat(parts[3]))
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
.get();
}
client().admin().indices().refresh(new RefreshRequest("test")).get();
}

public void testIssue10719() throws Exception {
Expand Down Expand Up @@ -221,10 +222,6 @@ 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)
);
// Test samples nested under samples
int MAX_DOCS_PER_AUTHOR = 1;
int MAX_DOCS_PER_GENRE = 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@

import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;

import org.opensearch.action.admin.indices.refresh.RefreshRequest;
import org.opensearch.action.search.SearchResponse;
import org.opensearch.action.search.SearchType;
import org.opensearch.action.support.WriteRequest;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.util.FeatureFlags;
import org.opensearch.index.query.TermQueryBuilder;
Expand Down Expand Up @@ -132,13 +132,14 @@ public void setupSuiteScopeCluster() throws Exception {
client().prepareIndex("test")
.setId("" + i)
.setSource("author", parts[5], "name", parts[2], "genre", parts[8], "price", Float.parseFloat(parts[3]))
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
.get();
client().prepareIndex("idx_unmapped_author")
.setId("" + i)
.setSource("name", parts[2], "genre", parts[8], "price", Float.parseFloat(parts[3]))
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
.get();
}
client().admin().indices().refresh(new RefreshRequest("test")).get();
}

public void testIssue10719() throws Exception {
Expand Down Expand Up @@ -195,6 +196,23 @@ public void testSimpleSampler() throws Exception {
assertThat(maxBooksPerAuthor, equalTo(3L));
}

public void testSimpleSamplerShardSize() throws Exception {
final int SHARD_SIZE = randomIntBetween(1, 3);
SamplerAggregationBuilder sampleAgg = sampler("sample").shardSize(SHARD_SIZE);
sohami marked this conversation as resolved.
Show resolved Hide resolved
sampleAgg.subAggregation(terms("authors").field("author"));
SearchResponse response = client().prepareSearch("test")
.setSearchType(SearchType.QUERY_THEN_FETCH)
.setQuery(new TermQueryBuilder("genre", "fantasy"))
.setFrom(0)
.setSize(60)
.addAggregation(sampleAgg)
.get();
assertSearchResponse(response);
Sampler sample = response.getAggregations().get("sample");
Terms authors = sample.getAggregations().get("authors");
assertEquals(SHARD_SIZE * NUM_SHARDS, sample.getDocCount());
}

public void testUnmappedChildAggNoDiversity() throws Exception {
SamplerAggregationBuilder sampleAgg = sampler("sample").shardSize(100);
sampleAgg.subAggregation(terms("authors").field("author"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,6 @@

@Override
protected boolean supportsConcurrentSegmentSearch() {
return true;
return false;

Check warning on line 165 in server/src/main/java/org/opensearch/search/aggregations/bucket/sampler/DiversifiedAggregatorFactory.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/org/opensearch/search/aggregations/bucket/sampler/DiversifiedAggregatorFactory.java#L165

Added line #L165 was not covered by tests
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@

@Override
protected boolean supportsConcurrentSegmentSearch() {
return true;
return false;

Check warning on line 78 in server/src/main/java/org/opensearch/search/aggregations/bucket/sampler/SamplerAggregatorFactory.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/org/opensearch/search/aggregations/bucket/sampler/SamplerAggregatorFactory.java#L78

Added line #L78 was not covered by tests
}
}
Loading