Skip to content

Commit 44cd922

Browse files
comments and such
1 parent e990b24 commit 44cd922

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

server/src/internalClusterTest/java/org/elasticsearch/action/admin/cluster/node/tasks/TasksIT.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryAction;
2727
import org.elasticsearch.action.bulk.TransportBulkAction;
2828
import org.elasticsearch.action.index.TransportIndexAction;
29-
import org.elasticsearch.action.search.SearchQueryThenFetchAsyncAction;
3029
import org.elasticsearch.action.search.SearchTransportService;
3130
import org.elasticsearch.action.search.TransportSearchAction;
3231
import org.elasticsearch.action.support.WriteRequest;
@@ -354,6 +353,7 @@ public void testTransportBulkTasks() {
354353
}
355354

356355
public void testSearchTaskDescriptions() {
356+
// TODO: enhance this test to also check the tasks created by batched query execution
357357
updateClusterSettings(Settings.builder().put(SearchService.BATCHED_QUERY_PHASE.getKey(), false));
358358
registerTaskManagerListeners(TransportSearchAction.TYPE.name()); // main task
359359
registerTaskManagerListeners(TransportSearchAction.TYPE.name() + "[*]"); // shard task
@@ -396,7 +396,6 @@ public void testSearchTaskDescriptions() {
396396
taskInfo.description(),
397397
Regex.simpleMatch("id[*], size[1], lastEmittedDoc[null]", taskInfo.description())
398398
);
399-
case SearchQueryThenFetchAsyncAction.NODE_SEARCH_ACTION_NAME -> assertThat(taskInfo.description(), notNullValue());
400399
default -> fail("Unexpected action [" + taskInfo.action() + "] with description [" + taskInfo.description() + "]");
401400
}
402401
// assert that all task descriptions have non-zero length

server/src/internalClusterTest/java/org/elasticsearch/search/SearchCancellationIT.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ public void testCancelMultiSearch() throws Exception {
240240
}
241241

242242
public void testCancelFailedSearchWhenPartialResultDisallowed() throws Exception {
243+
// TODO: make this test compatible with batched execution, currently the exceptions are slightly different with batched
243244
updateClusterSettings(Settings.builder().put(SearchService.BATCHED_QUERY_PHASE.getKey(), false));
244245
// Have at least two nodes so that we have parallel execution of two request guaranteed even if max concurrent requests per node
245246
// are limited to 1

server/src/internalClusterTest/java/org/elasticsearch/search/aggregations/bucket/TermsDocCountErrorIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ public static String randomExecutionHint() {
5555

5656
@Before
5757
public void disableBatchedExecution() {
58+
// TODO: it's practically impossible to get a 100% deterministic test with batched execution unfortunately, adjust this test to
59+
// still do something useful with batched execution (i.e. use somewhat relaxed assertions)
5860
updateClusterSettings(Settings.builder().put(SearchService.BATCHED_QUERY_PHASE.getKey(), false));
5961
}
6062

@@ -922,7 +924,6 @@ public void testDoubleValueFieldSubAggDesc() throws Exception {
922924
* 3 one-shard indices.
923925
*/
924926
public void testFixedDocs() throws Exception {
925-
updateClusterSettings(Settings.builder().put(SearchService.BATCHED_QUERY_PHASE.getKey(), false));
926927
assertNoFailuresAndResponse(
927928
prepareSearch("idx_fixed_docs_0", "idx_fixed_docs_1", "idx_fixed_docs_2").addAggregation(
928929
terms("terms").executionHint(randomExecutionHint())
@@ -971,7 +972,6 @@ public void testFixedDocs() throws Exception {
971972
assertThat(bucket.getDocCountError(), equalTo(29L));
972973
}
973974
);
974-
updateClusterSettings(Settings.builder().putNull(SearchService.BATCHED_QUERY_PHASE.getKey()));
975975
}
976976

977977
/**

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,7 @@ public boolean hasReferences() {
269269
public boolean decRef() {
270270
if (refCounted.decRef()) {
271271
for (int i = 0; i < results.length; i++) {
272-
Object result = results[i];
273-
if (result instanceof RefCounted r) {
272+
if (results[i] instanceof RefCounted r) {
274273
r.decRef();
275274
}
276275
results[i] = null;
@@ -530,7 +529,7 @@ private void onNodeQueryFailure(Exception e, NodeQueryRequest request, CanMatchP
530529

531530
private static final CircuitBreaker NOOP_CIRCUIT_BREAKER = new NoopCircuitBreaker("request");
532531

533-
public static void registerNodeSearchAction(
532+
static void registerNodeSearchAction(
534533
SearchTransportService searchTransportService,
535534
SearchService searchService,
536535
SearchPhaseController searchPhaseController
@@ -817,6 +816,7 @@ && isPartOfPIT(searchRequest.searchRequest, q.getContextId()) == false) {
817816
void consumeResult(QuerySearchResult queryResult) {
818817
// no need for any cache effects when we're already flipped to ture => plain read + set-release
819818
hasResponse.compareAndExchangeRelease(false, true);
819+
// TODO: dry up the bottom sort collector with the coordinator side logic in the top-level class here
820820
if (queryResult.isNull() == false
821821
// disable sort optims for scroll requests because they keep track of the last bottom doc locally (per shard)
822822
&& searchRequest.searchRequest.scroll() == null

0 commit comments

Comments
 (0)