Skip to content

Commit c081cfa

Browse files
committed
Use a serial merge scheduler to avoid race conditions when checking for hasPendingMerges().
Closes #12763
1 parent 4e2ce76 commit c081cfa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2372,7 +2372,10 @@ public void testCorruptFirstCommit() throws Exception {
23722372

23732373
public void testHasUncommittedChanges() throws IOException {
23742374
Directory dir = newDirectory();
2375-
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(new MockAnalyzer(random())));
2375+
IndexWriter writer = new IndexWriter(dir,
2376+
newIndexWriterConfig(new MockAnalyzer(random()))
2377+
// Use a serial merge scheduler to avoid race conditions when checking for hasPendingMerges()
2378+
.setMergeScheduler(new SerialMergeScheduler()));
23762379
assertTrue(
23772380
writer.hasUncommittedChanges()); // this will be true because a commit will create an empty
23782381
// index

0 commit comments

Comments
 (0)