|
@@ -96,6 +96,7 @@ import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
import java.util.Set;
|
|
import java.util.Set;
|
|
|
import java.util.TreeMap;
|
|
import java.util.TreeMap;
|
|
|
|
|
+import java.util.concurrent.Executor;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
import static org.elasticsearch.test.ListMatcher.matchesList;
|
|
import static org.elasticsearch.test.ListMatcher.matchesList;
|
|
@@ -107,7 +108,6 @@ import static org.elasticsearch.xpack.esql.CsvTestUtils.loadPageFromCsv;
|
|
|
import static org.elasticsearch.xpack.esql.CsvTestsDataLoader.CSV_DATASET_MAP;
|
|
import static org.elasticsearch.xpack.esql.CsvTestsDataLoader.CSV_DATASET_MAP;
|
|
|
import static org.elasticsearch.xpack.esql.EsqlTestUtils.TEST_VERIFIER;
|
|
import static org.elasticsearch.xpack.esql.EsqlTestUtils.TEST_VERIFIER;
|
|
|
import static org.elasticsearch.xpack.esql.EsqlTestUtils.loadMapping;
|
|
import static org.elasticsearch.xpack.esql.EsqlTestUtils.loadMapping;
|
|
|
-import static org.elasticsearch.xpack.esql.plugin.EsqlPlugin.ESQL_THREAD_POOL_NAME;
|
|
|
|
|
import static org.elasticsearch.xpack.ql.CsvSpecReader.specParser;
|
|
import static org.elasticsearch.xpack.ql.CsvSpecReader.specParser;
|
|
|
import static org.elasticsearch.xpack.ql.TestUtils.classpathResources;
|
|
import static org.elasticsearch.xpack.ql.TestUtils.classpathResources;
|
|
|
import static org.hamcrest.Matchers.equalTo;
|
|
import static org.hamcrest.Matchers.equalTo;
|
|
@@ -161,6 +161,7 @@ public class CsvTests extends ESTestCase {
|
|
|
private final Mapper mapper = new Mapper(functionRegistry);
|
|
private final Mapper mapper = new Mapper(functionRegistry);
|
|
|
private final PhysicalPlanOptimizer physicalPlanOptimizer = new TestPhysicalPlanOptimizer(new PhysicalOptimizerContext(configuration));
|
|
private final PhysicalPlanOptimizer physicalPlanOptimizer = new TestPhysicalPlanOptimizer(new PhysicalOptimizerContext(configuration));
|
|
|
private ThreadPool threadPool;
|
|
private ThreadPool threadPool;
|
|
|
|
|
+ private Executor executor;
|
|
|
|
|
|
|
|
@ParametersFactory(argumentFormatting = "%2$s.%3$s")
|
|
@ParametersFactory(argumentFormatting = "%2$s.%3$s")
|
|
|
public static List<Object[]> readScriptSpec() throws Exception {
|
|
public static List<Object[]> readScriptSpec() throws Exception {
|
|
@@ -174,18 +175,17 @@ public class CsvTests extends ESTestCase {
|
|
|
@Before
|
|
@Before
|
|
|
public void setUp() throws Exception {
|
|
public void setUp() throws Exception {
|
|
|
super.setUp();
|
|
super.setUp();
|
|
|
- int numThreads = randomBoolean() ? 1 : between(2, 16);
|
|
|
|
|
- threadPool = new TestThreadPool(
|
|
|
|
|
- "CsvTests",
|
|
|
|
|
- new FixedExecutorBuilder(
|
|
|
|
|
- Settings.EMPTY,
|
|
|
|
|
- ESQL_THREAD_POOL_NAME,
|
|
|
|
|
- numThreads,
|
|
|
|
|
- 1024,
|
|
|
|
|
- "esql",
|
|
|
|
|
- EsExecutors.TaskTrackingConfig.DEFAULT
|
|
|
|
|
- )
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ if (randomBoolean()) {
|
|
|
|
|
+ int numThreads = randomBoolean() ? 1 : between(2, 16);
|
|
|
|
|
+ threadPool = new TestThreadPool(
|
|
|
|
|
+ "CsvTests",
|
|
|
|
|
+ new FixedExecutorBuilder(Settings.EMPTY, "esql_test", numThreads, 1024, "esql", EsExecutors.TaskTrackingConfig.DEFAULT)
|
|
|
|
|
+ );
|
|
|
|
|
+ executor = threadPool.executor("esql_test");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ threadPool = new TestThreadPool(getTestName());
|
|
|
|
|
+ executor = threadPool.executor(ThreadPool.Names.SEARCH);
|
|
|
|
|
+ }
|
|
|
HeaderWarning.setThreadContext(threadPool.getThreadContext());
|
|
HeaderWarning.setThreadContext(threadPool.getThreadContext());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -343,7 +343,7 @@ public class CsvTests extends ESTestCase {
|
|
|
bigArrays,
|
|
bigArrays,
|
|
|
ByteSizeValue.ofBytes(randomLongBetween(1, BlockFactory.DEFAULT_MAX_BLOCK_PRIMITIVE_ARRAY_SIZE.getBytes() * 2))
|
|
ByteSizeValue.ofBytes(randomLongBetween(1, BlockFactory.DEFAULT_MAX_BLOCK_PRIMITIVE_ARRAY_SIZE.getBytes() * 2))
|
|
|
);
|
|
);
|
|
|
- ExchangeSourceHandler exchangeSource = new ExchangeSourceHandler(between(1, 64), threadPool.executor(ESQL_THREAD_POOL_NAME));
|
|
|
|
|
|
|
+ ExchangeSourceHandler exchangeSource = new ExchangeSourceHandler(between(1, 64), executor);
|
|
|
ExchangeSinkHandler exchangeSink = new ExchangeSinkHandler(blockFactory, between(1, 64), threadPool::relativeTimeInMillis);
|
|
ExchangeSinkHandler exchangeSink = new ExchangeSinkHandler(blockFactory, between(1, 64), threadPool::relativeTimeInMillis);
|
|
|
LocalExecutionPlanner executionPlanner = new LocalExecutionPlanner(
|
|
LocalExecutionPlanner executionPlanner = new LocalExecutionPlanner(
|
|
|
sessionId,
|
|
sessionId,
|
|
@@ -406,13 +406,7 @@ public class CsvTests extends ESTestCase {
|
|
|
DriverRunner runner = new DriverRunner(threadPool.getThreadContext()) {
|
|
DriverRunner runner = new DriverRunner(threadPool.getThreadContext()) {
|
|
|
@Override
|
|
@Override
|
|
|
protected void start(Driver driver, ActionListener<Void> driverListener) {
|
|
protected void start(Driver driver, ActionListener<Void> driverListener) {
|
|
|
- Driver.start(
|
|
|
|
|
- threadPool.getThreadContext(),
|
|
|
|
|
- threadPool.executor(ESQL_THREAD_POOL_NAME),
|
|
|
|
|
- driver,
|
|
|
|
|
- between(1, 1000),
|
|
|
|
|
- driverListener
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ Driver.start(threadPool.getThreadContext(), executor, driver, between(1, 1000), driverListener);
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
PlainActionFuture<ActualResults> future = new PlainActionFuture<>();
|
|
PlainActionFuture<ActualResults> future = new PlainActionFuture<>();
|