From e5f293c646a80b3265e59853e8d9b5bf20f6635e Mon Sep 17 00:00:00 2001 From: Ticheng Lin Date: Wed, 7 Jun 2023 03:20:33 +0000 Subject: [PATCH] Change query profile collector field data types to primitives and add more tests Signed-off-by: Ticheng Lin --- .../search/profile/query/CollectorResult.java | 22 +- .../InternalProfileCollectorManager.java | 8 +- .../search/query/QueryProfilePhaseTests.java | 266 ++++++++++++++++++ 3 files changed, 281 insertions(+), 15 deletions(-) diff --git a/server/src/main/java/org/opensearch/search/profile/query/CollectorResult.java b/server/src/main/java/org/opensearch/search/profile/query/CollectorResult.java index 2cce289abbaa8..a624cbc0bb7d6 100644 --- a/server/src/main/java/org/opensearch/search/profile/query/CollectorResult.java +++ b/server/src/main/java/org/opensearch/search/profile/query/CollectorResult.java @@ -98,22 +98,22 @@ public class CollectorResult implements ToXContentObject, Writeable { /** * The total elapsed time in reduce phase for this CollectorManager */ - private final Long reduceTime; + private final long reduceTime; /** * The maximum slice time for this CollectorManager */ - private final Long maxSliceTime; + private final long maxSliceTime; /** * The minimum slice time for this CollectorManager */ - private final Long minSliceTime; + private final long minSliceTime; /** * The average slice time for this CollectorManager */ - private final Long avgSliceTime; + private final long avgSliceTime; /** * The segment slice count for this CollectorManager @@ -125,18 +125,18 @@ public class CollectorResult implements ToXContentObject, Writeable { */ private List children; - public CollectorResult(String collectorName, String reason, Long time, List children) { + public CollectorResult(String collectorName, String reason, long time, List children) { this(collectorName, reason, time, 0L, time, time, time, 1, children); } public CollectorResult( String collectorName, String reason, - Long time, - Long reduceTime, - Long maxSliceTime, - Long minSliceTime, - Long avgSliceTime, + long time, + long reduceTime, + long maxSliceTime, + long minSliceTime, + long avgSliceTime, int sliceCount, List children ) { @@ -235,7 +235,7 @@ public long getAvgSliceTime() { /** * @return the profiled segment slice count for this collector manager (inclusive of children) */ - public long getSliceCount() { + public int getSliceCount() { return this.sliceCount; } diff --git a/server/src/main/java/org/opensearch/search/profile/query/InternalProfileCollectorManager.java b/server/src/main/java/org/opensearch/search/profile/query/InternalProfileCollectorManager.java index 807c223bc8540..074738d2491ec 100644 --- a/server/src/main/java/org/opensearch/search/profile/query/InternalProfileCollectorManager.java +++ b/server/src/main/java/org/opensearch/search/profile/query/InternalProfileCollectorManager.java @@ -90,19 +90,19 @@ public long getTime() { return time; } - public Long getReduceTime() { + public long getReduceTime() { return reduceTime; } - public Long getMaxSliceTime() { + public long getMaxSliceTime() { return maxSliceTime; } - public Long getMinSliceTime() { + public long getMinSliceTime() { return minSliceTime; } - public Long getAvgSliceTime() { + public long getAvgSliceTime() { return avgSliceTime; } diff --git a/server/src/test/java/org/opensearch/search/query/QueryProfilePhaseTests.java b/server/src/test/java/org/opensearch/search/query/QueryProfilePhaseTests.java index 5bd2cd5ee8beb..b1fc5f1354039 100644 --- a/server/src/test/java/org/opensearch/search/query/QueryProfilePhaseTests.java +++ b/server/src/test/java/org/opensearch/search/query/QueryProfilePhaseTests.java @@ -161,6 +161,13 @@ public void testPostFilterDisablesCountOptimization() throws Exception { }, collector -> { assertThat(collector.getReason(), equalTo("search_count")); assertThat(collector.getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getSliceCount(), greaterThanOrEqualTo(1)); assertThat(collector.getProfiledChildren(), empty()); }); @@ -171,9 +178,23 @@ public void testPostFilterDisablesCountOptimization() throws Exception { assertProfileData(context, collector -> { assertThat(collector.getReason(), equalTo("search_post_filter")); assertThat(collector.getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getSliceCount(), greaterThanOrEqualTo(1)); assertThat(collector.getProfiledChildren(), hasSize(1)); assertThat(collector.getProfiledChildren().get(0).getReason(), equalTo("search_count")); assertThat(collector.getProfiledChildren().get(0).getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getProfiledChildren().get(0).getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getProfiledChildren().get(0).getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getSliceCount(), greaterThanOrEqualTo(1)); }, (query) -> { assertThat(query.getQueryName(), equalTo("MatchNoDocsQuery")); assertThat(query.getTimeBreakdown().keySet(), not(empty())); @@ -224,12 +245,33 @@ public void testTerminateAfterWithFilter() throws Exception { assertProfileData(context, collector -> { assertThat(collector.getReason(), equalTo("search_post_filter")); assertThat(collector.getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getSliceCount(), greaterThanOrEqualTo(1)); assertThat(collector.getProfiledChildren(), hasSize(1)); assertThat(collector.getProfiledChildren().get(0).getReason(), equalTo("search_terminate_after_count")); assertThat(collector.getProfiledChildren().get(0).getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getProfiledChildren().get(0).getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getProfiledChildren().get(0).getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getSliceCount(), greaterThanOrEqualTo(1)); assertThat(collector.getProfiledChildren().get(0).getProfiledChildren(), hasSize(1)); assertThat(collector.getProfiledChildren().get(0).getProfiledChildren().get(0).getReason(), equalTo("search_top_hits")); assertThat(collector.getProfiledChildren().get(0).getProfiledChildren().get(0).getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getProfiledChildren().get(0).getProfiledChildren().get(0).getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getProfiledChildren().get(0).getProfiledChildren().get(0).getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getProfiledChildren().get(0).getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getProfiledChildren().get(0).getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getProfiledChildren().get(0).getSliceCount(), greaterThanOrEqualTo(1)); }, (query) -> { assertThat(query.getQueryName(), equalTo("TermQuery")); assertThat(query.getTimeBreakdown().keySet(), not(empty())); @@ -277,6 +319,13 @@ public void testMinScoreDisablesCountOptimization() throws Exception { }, collector -> { assertThat(collector.getReason(), equalTo("search_count")); assertThat(collector.getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getSliceCount(), greaterThanOrEqualTo(1)); assertThat(collector.getProfiledChildren(), empty()); }); @@ -293,9 +342,23 @@ public void testMinScoreDisablesCountOptimization() throws Exception { }, collector -> { assertThat(collector.getReason(), equalTo("search_min_score")); assertThat(collector.getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getSliceCount(), greaterThanOrEqualTo(1)); assertThat(collector.getProfiledChildren(), hasSize(1)); assertThat(collector.getProfiledChildren().get(0).getReason(), equalTo("search_count")); assertThat(collector.getProfiledChildren().get(0).getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getProfiledChildren().get(0).getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getProfiledChildren().get(0).getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getSliceCount(), greaterThanOrEqualTo(1)); }); reader.close(); @@ -338,6 +401,13 @@ public void testInOrderScrollOptimization() throws Exception { }, collector -> { assertThat(collector.getReason(), equalTo("search_top_hits")); assertThat(collector.getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getSliceCount(), greaterThanOrEqualTo(1)); assertThat(collector.getProfiledChildren(), empty()); }); @@ -359,6 +429,13 @@ public void testInOrderScrollOptimization() throws Exception { }, collector -> { assertThat(collector.getReason(), equalTo("search_top_hits")); assertThat(collector.getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getSliceCount(), greaterThanOrEqualTo(1)); assertThat(collector.getProfiledChildren(), hasSize(0)); }); @@ -404,9 +481,23 @@ public void testTerminateAfterEarlyTermination() throws Exception { }, collector -> { assertThat(collector.getReason(), equalTo("search_terminate_after_count")); assertThat(collector.getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getSliceCount(), greaterThanOrEqualTo(1)); assertThat(collector.getProfiledChildren(), hasSize(1)); assertThat(collector.getProfiledChildren().get(0).getReason(), equalTo("search_top_hits")); assertThat(collector.getProfiledChildren().get(0).getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getProfiledChildren().get(0).getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getProfiledChildren().get(0).getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getSliceCount(), greaterThanOrEqualTo(1)); }); context.setSize(0); @@ -425,9 +516,23 @@ public void testTerminateAfterEarlyTermination() throws Exception { }, collector -> { assertThat(collector.getReason(), equalTo("search_terminate_after_count")); assertThat(collector.getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getSliceCount(), greaterThanOrEqualTo(1)); assertThat(collector.getProfiledChildren(), hasSize(1)); assertThat(collector.getProfiledChildren().get(0).getReason(), equalTo("search_count")); assertThat(collector.getProfiledChildren().get(0).getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getProfiledChildren().get(0).getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getProfiledChildren().get(0).getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getSliceCount(), greaterThanOrEqualTo(1)); }); } @@ -446,9 +551,23 @@ public void testTerminateAfterEarlyTermination() throws Exception { }, collector -> { assertThat(collector.getReason(), equalTo("search_terminate_after_count")); assertThat(collector.getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getSliceCount(), greaterThanOrEqualTo(1)); assertThat(collector.getProfiledChildren(), hasSize(1)); assertThat(collector.getProfiledChildren().get(0).getReason(), equalTo("search_top_hits")); assertThat(collector.getProfiledChildren().get(0).getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getProfiledChildren().get(0).getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getProfiledChildren().get(0).getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getSliceCount(), greaterThanOrEqualTo(1)); }); } { @@ -481,9 +600,23 @@ public void testTerminateAfterEarlyTermination() throws Exception { }, collector -> { assertThat(collector.getReason(), equalTo("search_terminate_after_count")); assertThat(collector.getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getSliceCount(), greaterThanOrEqualTo(1)); assertThat(collector.getProfiledChildren(), hasSize(1)); assertThat(collector.getProfiledChildren().get(0).getReason(), equalTo("search_top_hits")); assertThat(collector.getProfiledChildren().get(0).getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getProfiledChildren().get(0).getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getProfiledChildren().get(0).getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getSliceCount(), greaterThanOrEqualTo(1)); }); context.setSize(0); context.parsedQuery(new ParsedQuery(bq)); @@ -529,9 +662,23 @@ public void testTerminateAfterEarlyTermination() throws Exception { }, collector -> { assertThat(collector.getReason(), equalTo("search_terminate_after_count")); assertThat(collector.getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getSliceCount(), greaterThanOrEqualTo(1)); assertThat(collector.getProfiledChildren(), hasSize(1)); assertThat(collector.getProfiledChildren().get(0).getReason(), equalTo("search_count")); assertThat(collector.getProfiledChildren().get(0).getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getProfiledChildren().get(0).getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getProfiledChildren().get(0).getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getSliceCount(), greaterThanOrEqualTo(1)); }); } @@ -571,9 +718,23 @@ public void testTerminateAfterEarlyTermination() throws Exception { }, collector -> { assertThat(collector.getReason(), equalTo("search_terminate_after_count")); assertThat(collector.getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getSliceCount(), greaterThanOrEqualTo(1)); assertThat(collector.getProfiledChildren(), hasSize(1)); assertThat(collector.getProfiledChildren().get(0).getReason(), equalTo("search_top_hits")); assertThat(collector.getProfiledChildren().get(0).getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getProfiledChildren().get(0).getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getProfiledChildren().get(0).getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getSliceCount(), greaterThanOrEqualTo(1)); }); } @@ -624,6 +785,13 @@ public void testIndexSortingEarlyTermination() throws Exception { }, collector -> { assertThat(collector.getReason(), equalTo("search_top_hits")); assertThat(collector.getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getSliceCount(), greaterThanOrEqualTo(1)); assertThat(collector.getProfiledChildren(), empty()); }); @@ -638,9 +806,23 @@ public void testIndexSortingEarlyTermination() throws Exception { assertProfileData(context, collector -> { assertThat(collector.getReason(), equalTo("search_post_filter")); assertThat(collector.getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getSliceCount(), greaterThanOrEqualTo(1)); assertThat(collector.getProfiledChildren(), hasSize(1)); assertThat(collector.getProfiledChildren().get(0).getReason(), equalTo("search_top_hits")); assertThat(collector.getProfiledChildren().get(0).getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getProfiledChildren().get(0).getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getProfiledChildren().get(0).getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getSliceCount(), greaterThanOrEqualTo(1)); }, (query) -> { assertThat(query.getQueryName(), equalTo("MinDocQuery")); assertThat(query.getTimeBreakdown().keySet(), not(empty())); @@ -680,6 +862,13 @@ public void testIndexSortingEarlyTermination() throws Exception { }, collector -> { assertThat(collector.getReason(), equalTo("search_top_hits")); assertThat(collector.getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getSliceCount(), greaterThanOrEqualTo(1)); assertThat(collector.getProfiledChildren(), empty()); }); @@ -699,6 +888,13 @@ public void testIndexSortingEarlyTermination() throws Exception { }, collector -> { assertThat(collector.getReason(), equalTo("search_top_hits")); assertThat(collector.getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getSliceCount(), greaterThanOrEqualTo(1)); assertThat(collector.getProfiledChildren(), empty()); }); } @@ -756,6 +952,13 @@ public void testIndexSortScrollOptimization() throws Exception { }, collector -> { assertThat(collector.getReason(), equalTo("search_top_hits")); assertThat(collector.getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getSliceCount(), greaterThanOrEqualTo(1)); assertThat(collector.getProfiledChildren(), empty()); }); @@ -785,6 +988,13 @@ public void testIndexSortScrollOptimization() throws Exception { }, collector -> { assertThat(collector.getReason(), equalTo("search_top_hits")); assertThat(collector.getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getSliceCount(), greaterThanOrEqualTo(1)); assertThat(collector.getProfiledChildren(), empty()); }); FieldDoc firstDoc = (FieldDoc) context.queryResult().topDocs().topDocs.scoreDocs[0]; @@ -848,6 +1058,13 @@ public void testDisableTopScoreCollection() throws Exception { }, collector -> { assertThat(collector.getReason(), equalTo("search_top_hits")); assertThat(collector.getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getSliceCount(), greaterThanOrEqualTo(1)); assertThat(collector.getProfiledChildren(), empty()); }); @@ -869,6 +1086,13 @@ public void testDisableTopScoreCollection() throws Exception { }, collector -> { assertThat(collector.getReason(), equalTo("search_top_hits")); assertThat(collector.getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getSliceCount(), greaterThanOrEqualTo(1)); assertThat(collector.getProfiledChildren(), empty()); }); @@ -924,9 +1148,23 @@ public void testMinScore() throws Exception { }, collector -> { assertThat(collector.getReason(), equalTo("search_min_score")); assertThat(collector.getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getSliceCount(), greaterThanOrEqualTo(1)); assertThat(collector.getProfiledChildren(), hasSize(1)); assertThat(collector.getProfiledChildren().get(0).getReason(), equalTo("search_top_hits")); assertThat(collector.getProfiledChildren().get(0).getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getProfiledChildren().get(0).getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getProfiledChildren().get(0).getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getProfiledChildren().get(0).getSliceCount(), greaterThanOrEqualTo(1)); }); reader.close(); @@ -987,6 +1225,13 @@ public void testMaxScore() throws Exception { }, collector -> { assertThat(collector.getReason(), equalTo("search_top_hits")); assertThat(collector.getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getSliceCount(), greaterThanOrEqualTo(1)); assertThat(collector.getProfiledChildren(), empty()); }); @@ -1015,6 +1260,13 @@ public void testMaxScore() throws Exception { }, collector -> { assertThat(collector.getReason(), equalTo("search_top_hits")); assertThat(collector.getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getSliceCount(), greaterThanOrEqualTo(1)); assertThat(collector.getProfiledChildren(), empty()); }); @@ -1068,6 +1320,13 @@ public void testCollapseQuerySearchResults() throws Exception { }, collector -> { assertThat(collector.getReason(), equalTo("search_top_hits")); assertThat(collector.getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getSliceCount(), greaterThanOrEqualTo(1)); assertThat(collector.getProfiledChildren(), empty()); }); @@ -1088,6 +1347,13 @@ public void testCollapseQuerySearchResults() throws Exception { }, collector -> { assertThat(collector.getReason(), equalTo("search_top_hits")); assertThat(collector.getTime(), greaterThan(0L)); + if (collector.getName().contains("CollectorManager")) { + assertThat(collector.getReduceTime(), greaterThan(0L)); + } + assertThat(collector.getMaxSliceTime(), greaterThan(0L)); + assertThat(collector.getMinSliceTime(), greaterThan(0L)); + assertThat(collector.getAvgSliceTime(), greaterThan(0L)); + assertThat(collector.getSliceCount(), greaterThanOrEqualTo(1)); assertThat(collector.getProfiledChildren(), empty()); });