Skip to content

Commit 5091983

Browse files
Fix ThreadPoolMergeSchedulerTests testSchedulerCloseWaitsForRunningMerge (elastic#130078) (elastic#130132)
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: elastic#125236
1 parent bf735f4 commit 5091983

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
@@ -281,9 +281,6 @@ tests:
281281
- class: org.elasticsearch.search.basic.SearchWithRandomDisconnectsIT
282282
method: testSearchWithRandomDisconnects
283283
issue: https://github.com/elastic/elasticsearch/issues/122707
284-
- class: org.elasticsearch.index.engine.ThreadPoolMergeSchedulerTests
285-
method: testSchedulerCloseWaitsForRunningMerge
286-
issue: https://github.com/elastic/elasticsearch/issues/125236
287284
- class: org.elasticsearch.packaging.test.DockerTests
288285
method: test020PluginsListWithNoPlugins
289286
issue: https://github.com/elastic/elasticsearch/issues/126232

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,11 +612,12 @@ public void testSchedulerCloseWaitsForRunningMerge() throws Exception {
612612
fail(e);
613613
}
614614
});
615+
// test expects that there definitely is a running merge before closing the merge scheduler
616+
mergeRunningLatch.await();
617+
// closes the merge scheduler
615618
t.start();
616619
try {
617620
assertTrue(t.isAlive());
618-
// wait for the merge to actually run
619-
mergeRunningLatch.await();
620621
// ensure the merge scheduler is effectively "closed"
621622
assertBusy(() -> {
622623
MergeSource mergeSource2 = mock(MergeSource.class);

0 commit comments

Comments
 (0)