Skip to content

Commit 3f7e23c

Browse files
authored
Clean up exchanges in EsqlNodeFailureIT (#121633) (#121690)
If the query hits the failing index first, we will cancel the request, preventing exchange-sink requests and data-node requests from reaching another data node. As a result, exchange sinks could stay for 30 seconds.
1 parent 7990781 commit 3f7e23c

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/EsqlNodeFailureIT.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
package org.elasticsearch.xpack.esql.action;
99

1010
import org.elasticsearch.action.index.IndexRequestBuilder;
11-
import org.elasticsearch.common.util.CollectionUtils;
11+
import org.elasticsearch.common.settings.Settings;
12+
import org.elasticsearch.compute.operator.exchange.ExchangeService;
13+
import org.elasticsearch.core.TimeValue;
1214
import org.elasticsearch.plugins.Plugin;
1315
import org.elasticsearch.test.ESIntegTestCase;
1416
import org.elasticsearch.test.FailingFieldPlugin;
@@ -27,9 +29,23 @@
2729
*/
2830
@ESIntegTestCase.ClusterScope(minNumDataNodes = 2)
2931
public class EsqlNodeFailureIT extends AbstractEsqlIntegTestCase {
32+
3033
@Override
3134
protected Collection<Class<? extends Plugin>> nodePlugins() {
32-
return CollectionUtils.appendToCopy(super.nodePlugins(), FailingFieldPlugin.class);
35+
var plugins = new ArrayList<>(super.nodePlugins());
36+
plugins.add(FailingFieldPlugin.class);
37+
plugins.add(InternalExchangePlugin.class);
38+
return plugins;
39+
}
40+
41+
@Override
42+
protected Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
43+
Settings settings = Settings.builder()
44+
.put(super.nodeSettings(nodeOrdinal, otherSettings))
45+
.put(ExchangeService.INACTIVE_SINKS_INTERVAL_SETTING, TimeValue.timeValueMillis(between(3000, 4000)))
46+
.build();
47+
logger.info("settings {}", settings);
48+
return settings;
3349
}
3450

3551
/**
@@ -49,7 +65,7 @@ public void testFailureLoadingFields() throws IOException {
4965
mapping.endObject();
5066
client().admin().indices().prepareCreate("fail").setSettings(indexSettings(1, 0)).setMapping(mapping.endObject()).get();
5167

52-
int docCount = 100;
68+
int docCount = 50;
5369
List<IndexRequestBuilder> docs = new ArrayList<>(docCount);
5470
for (int d = 0; d < docCount; d++) {
5571
docs.add(client().prepareIndex("ok").setSource("foo", d));

0 commit comments

Comments
 (0)