Skip to content

Commit 8517a7c

Browse files
Atri SharmaAtri Sharma
authored andcommitted
Clean up verbose comments
1 parent 837bcf4 commit 8517a7c

File tree

13 files changed

+5
-63
lines changed

13 files changed

+5
-63
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import org.apache.logging.log4j.LogManager;
3636
import org.apache.logging.log4j.Logger;
3737
import org.apache.lucene.search.TopDocs;
38-
import org.apache.lucene.search.TotalHits;
3938
import org.opensearch.common.lease.Releasable;
4039
import org.opensearch.common.lease.Releasables;
4140
import org.opensearch.common.lucene.search.TopDocsAndMaxScore;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ public XContentBuilder innerToXContent(XContentBuilder builder, Params params) t
355355
if (getNumReducePhases() != 1) {
356356
builder.field(NUM_REDUCE_PHASES.getPreferredName(), getNumReducePhases());
357357
}
358-
358+
359359
RestActions.buildBroadcastShardsHeader(
360360
builder,
361361
params,

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@
1616

1717
/**
1818
* Query phase result consumer for streaming search.
19-
* Supports progressive batch reduction with a fixed batch policy suitable for unsorted streaming.
2019
*
2120
* @opensearch.internal
2221
*/
2322
public class StreamQueryPhaseResultConsumer extends QueryPhaseResultConsumer {
2423

25-
26-
2724
/**
2825
* Creates a streaming query phase result consumer.
2926
*/
@@ -49,18 +46,9 @@ public StreamQueryPhaseResultConsumer(
4946
);
5047
}
5148

52-
/**
53-
* Controls partial reduction frequency.
54-
* With NO_SCORING streaming, we reduce immediately for fastest TTFB.
55-
*
56-
* @param requestBatchedReduceSize request batch size
57-
* @param minBatchReduceSize minimum batch size
58-
*/
5949
@Override
6050
int getBatchReduceSize(int requestBatchedReduceSize, int minBatchReduceSize) {
6151
// Reduce immediately for fastest TTFB
6252
return Math.min(requestBatchedReduceSize, 1);
6353
}
6454
}
65-
66-

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

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,6 @@ public class StreamSearchQueryThenFetchAsyncAction extends SearchQueryThenFetchA
7373
this.logger = logger;
7474
}
7575

76-
/**
77-
* Override the extension point to create streaming listeners instead of regular
78-
* listeners
79-
*/
8076
@Override
8177
SearchActionListener<SearchPhaseResult> createShardActionListener(
8278
final SearchShardTarget shard,
@@ -145,11 +141,6 @@ protected void onStreamResult(SearchPhaseResult result, SearchShardIterator shar
145141
results.consumeResult(result, next);
146142
}
147143

148-
/**
149-
* Override onShardResult to handle streaming search results safely.
150-
* This prevents the "topDocs already consumed" error when processing
151-
* multiple streaming results from the same shard.
152-
*/
153144
@Override
154145
protected void onShardResult(SearchPhaseResult result, SearchShardIterator shardIt) {
155146
// Trace final shard responses to diagnose coordinator sequencing.
@@ -162,14 +153,9 @@ protected void onShardResult(SearchPhaseResult result, SearchShardIterator shard
162153
expectedTotalOps
163154
);
164155
}
165-
// Always delegate to the parent to ensure shard accounting and phase
166-
// transitions.
167156
super.onShardResult(result, shardIt);
168157
}
169158

170-
/**
171-
* Override successful shard execution to handle stream result synchronization
172-
*/
173159
@Override
174160
void successfulShardExecution(SearchShardIterator shardsIt) {
175161
final int remainingOpsOnIterator;
@@ -194,11 +180,6 @@ void successfulShardExecution(SearchShardIterator shardsIt) {
194180
}
195181
}
196182

197-
/**
198-
* Handle successful stream execution callback
199-
* Partials are not fed into the reducer, so coordinator completion is driven
200-
* by {@link #successfulShardExecution(SearchShardIterator)}.
201-
*/
202183
private void successfulStreamExecution() {
203184
// No-op.
204185
}

server/src/main/java/org/opensearch/rest/action/search/RestSearchAction.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
import org.opensearch.action.search.SearchAction;
4040
import org.opensearch.action.search.SearchContextId;
4141
import org.opensearch.action.search.SearchRequest;
42-
import org.opensearch.action.search.SearchResponse;
4342
import org.opensearch.action.search.StreamSearchAction;
4443
import org.opensearch.action.support.IndicesOptions;
4544
import org.opensearch.common.Booleans;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
import org.opensearch.search.aggregations.bucket.LocalBucketCountThresholds;
3333
import org.opensearch.search.aggregations.support.ValuesSource;
3434
import org.opensearch.search.internal.SearchContext;
35-
import org.opensearch.search.streaming.StreamingCostMetrics;
3635
import org.opensearch.search.streaming.StreamingCostEstimable;
36+
import org.opensearch.search.streaming.StreamingCostMetrics;
3737

3838
import java.io.IOException;
3939
import java.util.ArrayList;

server/src/main/java/org/opensearch/search/aggregations/metrics/StreamCardinalityAggregator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
import org.opensearch.search.aggregations.support.ValuesSource;
1717
import org.opensearch.search.aggregations.support.ValuesSourceConfig;
1818
import org.opensearch.search.internal.SearchContext;
19-
import org.opensearch.search.streaming.StreamingCostMetrics;
2019
import org.opensearch.search.streaming.StreamingCostEstimable;
20+
import org.opensearch.search.streaming.StreamingCostMetrics;
2121

2222
import java.io.IOException;
2323
import java.util.List;

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ public static StreamingSearchMode fromString(String mode) {
5858
return NO_SCORING; // Default
5959
}
6060

61-
// Backward compatibility: coerce older scored modes into NO_SCORING
6261
if ("SCORED_UNSORTED".equalsIgnoreCase(mode) || "SCORED_SORTED".equalsIgnoreCase(mode) || "NO_SCORING".equalsIgnoreCase(mode)) {
6362
return NO_SCORING;
6463
}
@@ -68,7 +67,7 @@ public static StreamingSearchMode fromString(String mode) {
6867
return m;
6968
}
7069
}
71-
70+
7271
throw new IllegalArgumentException("Unknown StreamingSearchMode: " + mode);
7372
}
7473

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,6 @@
2929
/**
3030
* Streaming collector context for NO_SCORING mode.
3131
* Collects documents without scoring for fastest emission.
32-
*
33-
* Implements memory-bounded collection using a "firstK" pattern where only the first K
34-
* documents are retained for the final result. Documents are collected in batches
35-
* controlled by search.streaming.batch_size setting (default: 10, max: 100).
36-
*
37-
* Memory footprint: O(K + batchSize) where K is the requested number of hits.
38-
*
39-
* Circuit Breaker Policy:
40-
* - Batch buffers: No CB checks as they're strictly bounded (10-100 docs) and cleared after emission
41-
* - FirstK list: Protected by parent QueryPhaseResultConsumer's circuit breaker during final reduction
42-
* - Max memory per collector: ~8KB for batch (100 docs * 16 bytes) + ~80KB for firstK (10000 docs * 16 bytes)
43-
* - Decision rationale: The overhead of CB checks (atomic operations) would exceed the memory saved
44-
* for such small, bounded allocations that are immediately released
4532
*/
4633
public class StreamingUnsortedCollectorContext extends TopDocsCollectorContext {
4734

server/src/main/java/org/opensearch/search/streaming/FlushModeResolver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
import org.opensearch.search.aggregations.metrics.MaxAggregationBuilder;
2323
import org.opensearch.search.aggregations.metrics.MinAggregationBuilder;
2424
import org.opensearch.search.aggregations.metrics.SumAggregationBuilder;
25-
import org.opensearch.search.profile.aggregation.ProfilingAggregator;
2625
import org.opensearch.search.internal.SearchContext;
26+
import org.opensearch.search.profile.aggregation.ProfilingAggregator;
2727

2828
import java.util.Collection;
2929

0 commit comments

Comments
 (0)