LUCENE-10574: Fix test failure.

If a LogByteSizeMergePolicy is used, then it might decide to not merge the two
one-document segments if their on-disk sizes are too different. Using a
LogDocMergePolicy addresses the issue as both segments are always considered
the same size.
This commit is contained in:
Adrien Grand 2022-05-18 23:31:47 +02:00
parent 268d29b845
commit 4240159b44
1 changed files with 3 additions and 1 deletions

View File

@ -539,6 +539,8 @@ public class TestIndexWriterOnDiskFull extends LuceneTestCase {
MockDirectoryWrapper dir = newMockDirectory();
// IndexWriter w = new IndexWriter(dir, newIndexWriterConfig(new
// MockAnalyzer(random)).setReaderPooling(true));
LogDocMergePolicy mp = new LogDocMergePolicy();
mp.setMergeFactor(2);
IndexWriter w =
new IndexWriter(
dir,
@ -546,7 +548,7 @@ public class TestIndexWriterOnDiskFull extends LuceneTestCase {
.setMergeScheduler(new SerialMergeScheduler())
.setReaderPooling(true)
.setMergePolicy(
new FilterMergePolicy(newLogMergePolicy(2)) {
new FilterMergePolicy(mp) {
@Override
public boolean keepFullyDeletedSegment(
IOSupplier<CodecReader> readerIOSupplier) throws IOException {