Skip to content

Commit a33708d

Browse files
Remove unused parameter from AbstractSearchAsyncAction.onShardResult (elastic#121887)
Recent cleanups made the shard iterator unused on this method.
1 parent ed04ffa commit a33708d

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

server/src/main/java/org/elasticsearch/action/search/AbstractSearchAsyncAction.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ private void doPerformPhaseOnShard(int shardIndex, SearchShardIterator shardIt,
290290
public void innerOnResponse(Result result) {
291291
try {
292292
releasable.close();
293-
onShardResult(result, shardIt);
293+
onShardResult(result);
294294
} catch (Exception exc) {
295295
onShardFailure(shardIndex, shard, shardIt, exc);
296296
}
@@ -513,9 +513,8 @@ private static boolean isTaskCancelledException(Exception e) {
513513
/**
514514
* Executed once for every successful shard level request.
515515
* @param result the result returned form the shard
516-
* @param shardIt the shard iterator
517516
*/
518-
protected void onShardResult(Result result, SearchShardIterator shardIt) {
517+
protected void onShardResult(Result result) {
519518
assert result.getShardIndex() != -1 : "shard index is not set";
520519
assert result.getSearchShardTarget() != null : "search shard target must not be null";
521520
hasShardResponse.set(true);
@@ -705,7 +704,7 @@ void sendReleaseSearchContext(ShardSearchContextId contextId, Transport.Connecti
705704
/**
706705
* Executed once all shard results have been received and processed
707706
* @see #onShardFailure(int, SearchShardTarget, Exception)
708-
* @see #onShardResult(SearchPhaseResult, SearchShardIterator)
707+
* @see #onShardResult(SearchPhaseResult)
709708
*/
710709
private void onPhaseDone() { // as a tribute to @kimchy aka. finishHim()
711710
executeNextPhase(getName(), this::getNextPhase);

server/src/main/java/org/elasticsearch/action/search/SearchQueryThenFetchAsyncAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ protected void onShardGroupFailure(int shardIndex, SearchShardTarget shardTarget
104104
}
105105

106106
@Override
107-
protected void onShardResult(SearchPhaseResult result, SearchShardIterator shardIt) {
107+
protected void onShardResult(SearchPhaseResult result) {
108108
QuerySearchResult queryResult = result.queryResult();
109109
if (queryResult.isNull() == false
110110
// disable sort optims for scroll requests because they keep track of the last bottom doc locally (per shard)
@@ -123,7 +123,7 @@ && getRequest().scroll() == null
123123
}
124124
bottomSortCollector.consumeTopDocs(topDocs, queryResult.sortValueFormats());
125125
}
126-
super.onShardResult(result, shardIt);
126+
super.onShardResult(result);
127127
}
128128

129129
static SearchPhase nextPhase(

server/src/test/java/org/elasticsearch/action/search/MockSearchPhaseContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ protected void executePhaseOnShard(
150150
SearchActionListener<SearchPhaseResult> listener
151151
) {
152152
onShardResult(new SearchPhaseResult() {
153-
}, shardIt);
153+
});
154154
}
155155

156156
@Override

0 commit comments

Comments
 (0)