Skip to content

Commit

Permalink
Removed test statements in TransportSearchAction
Browse files Browse the repository at this point in the history
Signed-off-by: sahil buddharaju <sahilbud@amazon.com>
  • Loading branch information
sahil buddharaju committed Jul 24, 2023
1 parent cfd5297 commit 64226ea
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,48 @@ abstract class AbstractSearchAsyncAction<Result extends SearchPhaseResult> exten
instanceStartMap.put("fetch", () -> searchRequestOperationsListener.onFetchPhaseStart(this));
instanceStartMap.put("expand", () -> searchRequestOperationsListener.onExpandSearchPhaseStart(this));

instanceEndMap.put("dfs", () -> searchRequestOperationsListener.onDFSPreQueryPhaseEnd(this, TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - this.getCurrentPhase().getStartTime())));
instanceEndMap.put("can_match", () -> searchRequestOperationsListener.onCanMatchPhaseEnd(this, TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - this.getCurrentPhase().getStartTime())));
instanceEndMap.put("dfs_query", () -> searchRequestOperationsListener.onQueryPhaseEnd(this, TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - this.getCurrentPhase().getStartTime())));
instanceEndMap.put("query", () -> searchRequestOperationsListener.onQueryPhaseEnd(this, TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - this.getCurrentPhase().getStartTime())));
instanceEndMap.put("fetch", () -> searchRequestOperationsListener.onFetchPhaseEnd(this, TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - this.getCurrentPhase().getStartTime())));
instanceEndMap.put("expand", () -> searchRequestOperationsListener.onExpandSearchPhaseEnd(this, TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - this.getCurrentPhase().getStartTime())));
instanceEndMap.put(
"dfs",
() -> searchRequestOperationsListener.onDFSPreQueryPhaseEnd(
this,
TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - this.getCurrentPhase().getStartTime())
)
);
instanceEndMap.put(
"can_match",
() -> searchRequestOperationsListener.onCanMatchPhaseEnd(
this,
TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - this.getCurrentPhase().getStartTime())
)
);
instanceEndMap.put(
"dfs_query",
() -> searchRequestOperationsListener.onQueryPhaseEnd(
this,
TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - this.getCurrentPhase().getStartTime())
)
);
instanceEndMap.put(
"query",
() -> searchRequestOperationsListener.onQueryPhaseEnd(
this,
TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - this.getCurrentPhase().getStartTime())
)
);
instanceEndMap.put(
"fetch",
() -> searchRequestOperationsListener.onFetchPhaseEnd(
this,
TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - this.getCurrentPhase().getStartTime())
)
);
instanceEndMap.put(
"expand",
() -> searchRequestOperationsListener.onExpandSearchPhaseEnd(
this,
TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - this.getCurrentPhase().getStartTime())
)
);

instanceFailMap.put("dfs", () -> searchRequestOperationsListener.onDFSPreQueryPhaseFailure(this));
instanceFailMap.put("can_match", () -> searchRequestOperationsListener.onCanMatchPhaseFailure(this));
Expand Down Expand Up @@ -467,6 +503,7 @@ private void onPhaseEnd(SearchPhaseContext searchPhaseContext) {
}
instanceEndMap.get(searchPhaseContext.getCurrentPhase().getName()).run();
}

private void onPhaseStart(SearchPhase phase, SearchPhaseContext searchPhaseContext) {
setCurrentPhase(phase);
phase.setStartTimeInNanos(System.nanoTime());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,6 @@ private void executeSearch(
concreteLocalIndices,
localShardIterators.size() + remoteShardIterators.size()
);
long test1 = timeProvider.buildTookInMillis();
AbstractSearchAsyncAction<? extends SearchPhaseResult> action = searchAsyncActionProvider.asyncSearchAction(
task,
searchRequest,
Expand All @@ -1026,7 +1025,6 @@ private void executeSearch(
threadPool,
clusters
);
long test10 = timeProvider.buildTookInMillis();
action.start();
}

Expand Down Expand Up @@ -1172,7 +1170,6 @@ public void run() {
searchListenersList
);
} else {
long test4 = timeProvider.buildTookInMillis();
final QueryPhaseResultConsumer queryResultConsumer = searchPhaseController.newSearchPhaseResults(
executor,
circuitBreaker,
Expand All @@ -1181,7 +1178,6 @@ public void run() {
shardIterators.size(),
exc -> cancelTask(task, exc)
);
long test5 = timeProvider.buildTookInMillis();
AbstractSearchAsyncAction<? extends SearchPhaseResult> searchAsyncAction;
switch (searchRequest.searchType()) {
case DFS_QUERY_THEN_FETCH:
Expand All @@ -1206,7 +1202,6 @@ public void run() {
);
break;
case QUERY_THEN_FETCH:
long test6 = timeProvider.buildTookInMillis();
searchAsyncAction = new SearchQueryThenFetchAsyncAction(
logger,
searchTransportService,
Expand All @@ -1226,7 +1221,6 @@ public void run() {
clusters,
searchListenersList
);
long test7 = timeProvider.buildTookInMillis();
break;
default:
throw new IllegalStateException("Unknown search type: [" + searchRequest.searchType() + "]");
Expand Down
2 changes: 1 addition & 1 deletion server/src/main/java/org/opensearch/node/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ protected Node(
remoteDirectoryFactory,
repositoriesServiceReference::get,
fileCacheCleaner,
requestStats
requestStats
);

final AliasValidator aliasValidator = new AliasValidator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -830,9 +830,7 @@ private ExpandSearchPhase createExpandSearchPhase() {
return new ExpandSearchPhase(mockSearchPhaseContext, internalSearchResponse, null);
}

private SearchRequestOperationsListener createSearchRequestOperationsListener(
SearchRequestStatsTesting searchCoordinatorStatsTesting
) {
private SearchRequestOperationsListener createSearchRequestOperationsListener(SearchRequestStatsTesting searchCoordinatorStatsTesting) {
return new SearchRequestOperationsListener() {
@Override
public void onDFSPreQueryPhaseStart(SearchPhaseContext context) {
Expand Down

0 comments on commit 64226ea

Please sign in to comment.