Skip to content

Commit bf486c1

Browse files
authored
Fix BatchedQueryPhaseIT.testNumReducePhases (elastic#135074)
The test should only run when the batched query execution feature flag is enabled, otherwise we run this when the setting is off and the assumptions in this test no longer hold. Closes elastic#134943
1 parent 5449919 commit bf486c1

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -549,9 +549,6 @@ tests:
549549
- class: org.elasticsearch.xpack.ml.integration.InferenceIT
550550
method: testInferRegressionModel
551551
issue: https://github.com/elastic/elasticsearch/issues/133603
552-
- class: org.elasticsearch.action.search.BatchedQueryPhaseIT
553-
method: testNumReducePhases
554-
issue: https://github.com/elastic/elasticsearch/issues/134943
555552
- class: org.elasticsearch.reservedstate.service.RepositoriesFileSettingsIT
556553
method: testSettingsApplied
557554
issue: https://github.com/elastic/elasticsearch/issues/126748

server/src/internalClusterTest/java/org/elasticsearch/action/search/BatchedQueryPhaseIT.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import org.elasticsearch.cluster.routing.IndexShardRoutingTable;
1717
import org.elasticsearch.cluster.routing.ShardRouting;
1818
import org.elasticsearch.common.settings.Settings;
19+
import org.elasticsearch.search.SearchService;
1920
import org.elasticsearch.test.ESIntegTestCase;
2021

2122
import java.util.Collections;
@@ -31,6 +32,10 @@
3132
public class BatchedQueryPhaseIT extends ESIntegTestCase {
3233

3334
public void testNumReducePhases() {
35+
assumeTrue(
36+
"test skipped because batched query execution disabled by feature flag",
37+
SearchService.BATCHED_QUERY_PHASE_FEATURE_FLAG.isEnabled()
38+
);
3439
String indexName = "test-idx";
3540
assertAcked(
3641
prepareCreate(indexName).setMapping("title", "type=keyword")

server/src/main/java/org/elasticsearch/search/SearchService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ public class SearchService extends AbstractLifecycleComponent implements IndexEv
298298
Setting.Property.NodeScope
299299
);
300300

301-
private static final boolean BATCHED_QUERY_PHASE_FEATURE_FLAG = new FeatureFlag("batched_query_phase").isEnabled();
301+
public static final FeatureFlag BATCHED_QUERY_PHASE_FEATURE_FLAG = new FeatureFlag("batched_query_phase");
302302

303303
/**
304304
* The size of the buffer used for memory accounting.
@@ -433,7 +433,7 @@ public SearchService(
433433
clusterService.getClusterSettings().addSettingsUpdateConsumer(SEARCH_WORKER_THREADS_ENABLED, this::setEnableSearchWorkerThreads);
434434

435435
enableQueryPhaseParallelCollection = QUERY_PHASE_PARALLEL_COLLECTION_ENABLED.get(settings);
436-
if (BATCHED_QUERY_PHASE_FEATURE_FLAG) {
436+
if (BATCHED_QUERY_PHASE_FEATURE_FLAG.isEnabled()) {
437437
batchQueryPhase = BATCHED_QUERY_PHASE.get(settings);
438438
} else {
439439
batchQueryPhase = false;

0 commit comments

Comments
 (0)