Skip to content

Commit 03df3d1

Browse files
100_000
1 parent 0db2025 commit 03df3d1

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

server/src/internalClusterTest/java/org/elasticsearch/index/engine/ThreadPoolMergeSchedulerStressTestIT.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,6 @@ public static class TestEnginePlugin extends Plugin implements EnginePlugin {
7979
final Semaphore runMergeSemaphore = new Semaphore(initialRunMergesCount);
8080
final int waitMergesEnqueuedCount = randomIntBetween(50, 100);
8181

82-
void allowAllMerging() {
83-
// even when indexing is done, queued and backlogged merges can themselves trigger further merging
84-
// don't let this test be bothered by that, and simply let all merging run unhindered
85-
if (runMergeSemaphore.availablePermits() < 10_000) {
86-
runMergeSemaphore.release(10_000);
87-
}
88-
}
89-
9082
class TestInternalEngine extends org.elasticsearch.index.engine.InternalEngine {
9183

9284
TestInternalEngine(EngineConfig engineConfig) {
@@ -267,10 +259,13 @@ public void testMergingFallsBehindAndThenCatchesUp() throws Exception {
267259
for (Thread indexingThread : indexingThreads) {
268260
indexingThread.join();
269261
}
262+
// even when indexing is done, queued and backlogged merges can themselves trigger further merging
263+
// don't let this test be bothered by that, and simply unblock all merges
264+
// 100k is a fudge value, but there's no easy way to find a smartest one here
265+
testEnginePlugin.runMergeSemaphore.release(100_000);
270266
// await all merging to catch up
271267
assertBusy(() -> {
272-
// unblock merge threads
273-
testEnginePlugin.allowAllMerging();
268+
assert testEnginePlugin.runMergeSemaphore.availablePermits() > 0 : "some merges are blocked, test is broken";
274269
assertThat(testEnginePlugin.runningMergesSet.size(), is(0));
275270
assertThat(testEnginePlugin.enqueuedMergesSet.size(), is(0));
276271
testEnginePlugin.mergeExecutorServiceReference.get().allDone();

0 commit comments

Comments
 (0)