Skip to content

Commit 2aa5501

Browse files
committed
Add test for force_merge threadpool size
1 parent 9d6a6df commit 2aa5501

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

server/src/test/java/org/elasticsearch/threadpool/ThreadPoolTests.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,4 +310,21 @@ public String toString() {
310310
assertTrue(terminate(threadPool));
311311
}
312312
}
313+
314+
public void testForceMergeThreadPoolSize() {
315+
final int allocatedProcessors = randomIntBetween(1, EsExecutors.allocatedProcessors(Settings.EMPTY));
316+
final ThreadPool threadPool = new TestThreadPool(
317+
"test",
318+
Settings.builder().put(EsExecutors.NODE_PROCESSORS_SETTING.getKey(), allocatedProcessors).build()
319+
);
320+
try {
321+
final int expectedSize = Math.max(1, allocatedProcessors / 8);
322+
ThreadPool.Info info = threadPool.info(ThreadPool.Names.FORCE_MERGE);
323+
assertThat(info.getThreadPoolType(), equalTo(ThreadPool.ThreadPoolType.FIXED));
324+
assertThat(info.getMin(), equalTo(expectedSize));
325+
assertThat(info.getMax(), equalTo(expectedSize));
326+
} finally {
327+
assertTrue(terminate(threadPool));
328+
}
329+
}
313330
}

0 commit comments

Comments
 (0)