Skip to content

Commit 417bf4f

Browse files
Fix ThreadPoolMergeSchedulerTests testSchedulerCloseWaitsForRunningMerge (#130078) (#130529)
This fixes a race condition in the test scenario, between the merge scheduler closing and the merge task being scheduled to run. The test scenario expects that the merge task runs when the scheduler is closed. If the merge scheduler is closed before the merge task is scheduled, the merge task will instead be scheduled as aborted. Fixes: #125236
1 parent 92b0387 commit 417bf4f

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,6 @@ tests:
273273
- class: org.elasticsearch.packaging.test.DockerTests
274274
method: test072RunEsAsDifferentUserAndGroup
275275
issue: https://github.com/elastic/elasticsearch/issues/128031
276-
- class: org.elasticsearch.index.engine.ThreadPoolMergeSchedulerTests
277-
method: testSchedulerCloseWaitsForRunningMerge
278-
issue: https://github.com/elastic/elasticsearch/issues/125236
279276
- class: org.elasticsearch.packaging.test.DockerTests
280277
method: test010Install
281278
issue: https://github.com/elastic/elasticsearch/issues/125680

server/src/test/java/org/elasticsearch/index/engine/ThreadPoolMergeSchedulerTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,11 +566,12 @@ public void testSchedulerCloseWaitsForRunningMerge() throws Exception {
566566
fail(e);
567567
}
568568
});
569+
// test expects that there definitely is a running merge before closing the merge scheduler
570+
mergeRunningLatch.await();
571+
// closes the merge scheduler
569572
t.start();
570573
try {
571574
assertTrue(t.isAlive());
572-
// wait for the merge to actually run
573-
mergeRunningLatch.await();
574575
// ensure the merge scheduler is effectively "closed"
575576
assertBusy(() -> {
576577
MergeSource mergeSource2 = mock(MergeSource.class);

0 commit comments

Comments
 (0)