|
17 | 17 | import org.apache.http.client.CredentialsProvider; |
18 | 18 | import org.apache.http.impl.client.BasicCredentialsProvider; |
19 | 19 | import org.apache.logging.log4j.core.config.plugins.util.PluginManager; |
| 20 | +import org.apache.lucene.util.IOConsumer; |
20 | 21 | import org.elasticsearch.ExceptionsHelper; |
21 | 22 | import org.elasticsearch.client.Request; |
22 | 23 | import org.elasticsearch.client.Response; |
@@ -401,41 +402,6 @@ private static void loadDataSetIntoEs( |
401 | 402 | boolean supportsSourceFieldMapping, |
402 | 403 | boolean inferenceEnabled, |
403 | 404 | IndexCreator indexCreator |
404 | | - ) throws IOException { |
405 | | - if (PARALLEL_THREADS > 1) { |
406 | | - loadDataSetIntoEsParallel(client, supportsIndexModeLookup, supportsSourceFieldMapping, inferenceEnabled, indexCreator); |
407 | | - } else { |
408 | | - loadDataSetIntoEsSequential(client, supportsIndexModeLookup, supportsSourceFieldMapping, inferenceEnabled, indexCreator); |
409 | | - } |
410 | | - } |
411 | | - |
412 | | - private static void loadDataSetIntoEsSequential( |
413 | | - RestClient client, |
414 | | - boolean supportsIndexModeLookup, |
415 | | - boolean supportsSourceFieldMapping, |
416 | | - boolean inferenceEnabled, |
417 | | - IndexCreator indexCreator |
418 | | - ) throws IOException { |
419 | | - Logger logger = LogManager.getLogger(CsvTestsDataLoader.class); |
420 | | - |
421 | | - Set<String> loadedDatasets = new HashSet<>(); |
422 | | - for (var dataset : availableDatasetsForEs(supportsIndexModeLookup, supportsSourceFieldMapping, inferenceEnabled)) { |
423 | | - createIndex(client, dataset, indexCreator); |
424 | | - loadData(client, dataset, logger); |
425 | | - loadedDatasets.add(dataset.indexName); |
426 | | - } |
427 | | - forceMerge(client, loadedDatasets, logger); |
428 | | - for (var policy : ENRICH_POLICIES) { |
429 | | - loadEnrichPolicy(client, policy.policyName, policy.policyFileName, logger); |
430 | | - } |
431 | | - } |
432 | | - |
433 | | - private static void loadDataSetIntoEsParallel( |
434 | | - RestClient client, |
435 | | - boolean supportsIndexModeLookup, |
436 | | - boolean supportsSourceFieldMapping, |
437 | | - boolean inferenceEnabled, |
438 | | - IndexCreator indexCreator |
439 | 405 | ) throws IOException { |
440 | 406 | Logger logger = LogManager.getLogger(CsvTestsDataLoader.class); |
441 | 407 | Set<TestDataset> datasets = availableDatasetsForEs(supportsIndexModeLookup, supportsSourceFieldMapping, inferenceEnabled); |
@@ -463,11 +429,6 @@ private static void loadDataSetIntoEsParallel( |
463 | 429 | } |
464 | 430 | } |
465 | 431 |
|
466 | | - @FunctionalInterface |
467 | | - private interface IOConsumer<T> { |
468 | | - void accept(T t) throws IOException; |
469 | | - } |
470 | | - |
471 | 432 | private static <T> void executeInParallel(ExecutorService executor, Iterable<T> items, IOConsumer<T> consumer, String errorMessage) |
472 | 433 | throws IOException { |
473 | 434 | List<Future<?>> futures = new ArrayList<>(); |
|
0 commit comments