|
14 | 14 | import org.elasticsearch.common.settings.ClusterSettings; |
15 | 15 | import org.elasticsearch.common.settings.Settings; |
16 | 16 | import org.elasticsearch.common.unit.ByteSizeValue; |
17 | | -import org.elasticsearch.common.util.concurrent.ConcurrentCollections; |
18 | 17 | import org.elasticsearch.common.util.concurrent.EsExecutors; |
19 | 18 | import org.elasticsearch.core.PathUtils; |
20 | 19 | import org.elasticsearch.core.PathUtilsForTesting; |
|
37 | 36 | import java.nio.file.attribute.FileStoreAttributeView; |
38 | 37 | import java.nio.file.spi.FileSystemProvider; |
39 | 38 | import java.util.LinkedHashSet; |
40 | | -import java.util.Set; |
41 | 39 | import java.util.concurrent.CountDownLatch; |
42 | | -import java.util.concurrent.Semaphore; |
43 | | -import java.util.concurrent.ThreadPoolExecutor; |
44 | 40 | import java.util.concurrent.TimeUnit; |
45 | | -import java.util.concurrent.atomic.AtomicInteger; |
46 | 41 | import java.util.concurrent.atomic.AtomicLong; |
47 | 42 | import java.util.concurrent.atomic.AtomicReference; |
48 | 43 |
|
49 | | -import static org.elasticsearch.index.engine.ThreadPoolMergeExecutorServiceTests.getThreadPoolMergeExecutorService; |
50 | | -import static org.elasticsearch.index.engine.ThreadPoolMergeScheduler.Schedule.ABORT; |
51 | 44 | import static org.elasticsearch.index.engine.ThreadPoolMergeScheduler.Schedule.BACKLOG; |
52 | 45 | import static org.elasticsearch.index.engine.ThreadPoolMergeScheduler.Schedule.RUN; |
53 | | -import static org.hamcrest.Matchers.equalTo; |
54 | 46 | import static org.hamcrest.Matchers.greaterThanOrEqualTo; |
55 | 47 | import static org.hamcrest.Matchers.is; |
56 | 48 | import static org.mockito.Mockito.doAnswer; |
@@ -337,11 +329,11 @@ public void testUnavailableBudgetBlocksEnqueuedMergeTasks() throws Exception { |
337 | 329 | // fewer merge tasks than pool threads so that there's always a free thread available |
338 | 330 | int submittedMergesCount = randomIntBetween(1, mergeExecutorThreadCount - 1); |
339 | 331 | Settings settings = Settings.builder() |
340 | | - .put(this.settings) |
341 | | - .put(ThreadPoolMergeScheduler.USE_THREAD_POOL_MERGE_SCHEDULER_SETTING.getKey(), true) |
342 | | - .put(EsExecutors.NODE_PROCESSORS_SETTING.getKey(), mergeExecutorThreadCount) |
343 | | - .put(ThreadPoolMergeExecutorService.INDICES_MERGE_DISK_CHECK_INTERVAL_SETTING.getKey(), "100ms") |
344 | | - .build(); |
| 332 | + .put(this.settings) |
| 333 | + .put(ThreadPoolMergeScheduler.USE_THREAD_POOL_MERGE_SCHEDULER_SETTING.getKey(), true) |
| 334 | + .put(EsExecutors.NODE_PROCESSORS_SETTING.getKey(), mergeExecutorThreadCount) |
| 335 | + .put(ThreadPoolMergeExecutorService.INDICES_MERGE_DISK_CHECK_INTERVAL_SETTING.getKey(), "100ms") |
| 336 | + .build(); |
345 | 337 | ClusterSettings clusterSettings = ClusterSettings.createBuiltInClusterSettings(settings); |
346 | 338 | aFileStore.totalSpace = 150_000L; |
347 | 339 | bFileStore.totalSpace = 140_000L; |
@@ -422,9 +414,7 @@ public void testUnavailableBudgetBlocksEnqueuedMergeTasks() throws Exception { |
422 | 414 | threadPoolMergeExecutorService.submitMergeTask(mergeTask); |
423 | 415 | } |
424 | 416 | // running (or aborting) merge tasks have depleted the available budget |
425 | | - assertBusy(() -> { |
426 | | - assertThat(threadPoolMergeExecutorService.getMergeTasksQueue().getAvailableBudget(), is(0L)); |
427 | | - }); |
| 417 | + assertBusy(() -> { assertThat(threadPoolMergeExecutorService.getMergeTasksQueue().getAvailableBudget(), is(0L)); }); |
428 | 418 | int moreMergeTasksCount = randomIntBetween(1, 10); |
429 | 419 | // any new merge tasks will only be enqueued but not actually run, until more budget becomes available |
430 | 420 | for (int i = 0; i < moreMergeTasksCount; i++) { |
|
0 commit comments