Skip to content

Commit 837bcf4

Browse files
Atri SharmaAtri Sharma
authored andcommitted
More cleanup
Signed-off-by: Atri Sharma <atrisharma@Atris-Mac-Studio.local>
1 parent 0f5c5c2 commit 837bcf4

File tree

3 files changed

+12
-27
lines changed

3 files changed

+12
-27
lines changed

server/src/main/java/org/opensearch/action/search/StreamSearchQueryThenFetchAsyncAction.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ protected void onStreamResult(SearchPhaseResult result, SearchShardIterator shar
152152
*/
153153
@Override
154154
protected void onShardResult(SearchPhaseResult result, SearchShardIterator shardIt) {
155-
// Safety log: track final shard response receipt in coordinator
155+
// Trace final shard responses to diagnose coordinator sequencing.
156156
if (logger.isTraceEnabled()) {
157157
logger.trace(
158158
"COORDINATOR: received final shard result from shard={}, target={}, totalOps={}, expectedOps={}",
@@ -196,12 +196,11 @@ void successfulShardExecution(SearchShardIterator shardsIt) {
196196

197197
/**
198198
* Handle successful stream execution callback
199-
* Since partials are no longer fed into the reducer, this callback is not
200-
* needed for coordination.
199+
* Partials are not fed into the reducer, so coordinator completion is driven
200+
* by {@link #successfulShardExecution(SearchShardIterator)}.
201201
*/
202202
private void successfulStreamExecution() {
203-
// No-op: partials are bypassed from reducer, completion is handled by
204-
// successfulShardExecution only
203+
// No-op.
205204
}
206205

207206
}

server/src/main/java/org/opensearch/search/aggregations/bucket/terms/StreamStringTermsAggregator.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,7 @@ public StreamingCostMetrics estimateStreamingCost(SearchContext context) {
514514
return StreamingCostMetrics.nonStreamable();
515515
}
516516

517-
// Calculate metrics (simplified for now to match StreamNumericTermsAggregator
518-
// pattern essentially)
519-
// But we need total bucket count from ordinals
517+
// Estimate streaming cost using segment ordinals.
520518
ValuesSource.Bytes.WithOrdinals ordinalValuesSource = (ValuesSource.Bytes.WithOrdinals) valuesSource;
521519
List<LeafReaderContext> leaves = context.searcher().getIndexReader().leaves();
522520
long maxCardinality = 0;

server/src/main/java/org/opensearch/search/query/StreamingSearchMode.java

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,28 @@
1111
import org.opensearch.common.annotation.ExperimentalApi;
1212

1313
/**
14-
* Defines the different streaming search strategies based on the design-by-case approach.
15-
* Each mode optimizes for different use cases and performance characteristics.
14+
* Streaming search mode selector.
15+
*
16+
* <p>Only {@link #NO_SCORING} is active in the current streaming implementation.
17+
* Other values are retained for request parsing/backward compatibility.
1618
*
1719
* @opensearch.internal
1820
*/
1921
@ExperimentalApi
2022
public enum StreamingSearchMode {
2123

2224
/**
23-
* Case 1: No scoring, no sorting - fastest TTFB
24-
* - Shard collector: StreamingUnsortedCollector
25-
* - Ring buffer with batch emission
26-
* - Round-robin merge at coordinator
27-
* - Best for: simple filtering, counting, exists queries
25+
* No scoring and no sorting.
2826
*/
2927
NO_SCORING("no_scoring"),
3028

3129
/**
32-
* Case 2: Full scoring + explicit sort - production ready
33-
* - Shard collector: StreamingSortedCollector
34-
* - WAND/Block-Max WAND with windowed top-K heap
35-
* - K-way streaming merge at coordinator
36-
* - Best for: scored searches with sorting
30+
* Retained for backward compatibility.
3731
*/
3832
SCORED_SORTED("scored_sorted"),
3933

4034
/**
41-
* Case 3: Full scoring, no sorting - moderate performance
42-
* - Shard collector: StreamingScoredUnsortedCollector
43-
* - Ring buffer with scoring
44-
* - No merge needed at coordinator
45-
* - Best for: scored searches without sorting
35+
* Retained for backward compatibility.
4636
*/
4737
SCORED_UNSORTED("scored_unsorted");
4838

@@ -98,8 +88,6 @@ public boolean requiresSorting() {
9888
return false; // No sorting is supported in the current mode
9989
}
10090

101-
// Confidence-based mode removed in this branch
102-
10391
@Override
10492
public String toString() {
10593
return value;

0 commit comments

Comments
 (0)