From 73371cb4b6365c4aca2700c2e14e20cdbf1e0c12 Mon Sep 17 00:00:00 2001 From: Adrien Grand Date: Thu, 3 Sep 2020 12:47:29 +0200 Subject: [PATCH] LUCENE-9486: Fix TestTieredMergePolicy failure. --- .../test/org/apache/lucene/index/TestTieredMergePolicy.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lucene/core/src/test/org/apache/lucene/index/TestTieredMergePolicy.java b/lucene/core/src/test/org/apache/lucene/index/TestTieredMergePolicy.java index 0172087f67f..b23aaa1f866 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestTieredMergePolicy.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestTieredMergePolicy.java @@ -29,6 +29,7 @@ import java.util.Map; import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; +import org.apache.lucene.document.StoredField; import org.apache.lucene.index.MergePolicy.MergeSpecification; import org.apache.lucene.index.MergePolicy.OneMerge; import org.apache.lucene.store.Directory; @@ -651,7 +652,10 @@ public class TestTieredMergePolicy extends BaseMergePolicyTestCase { IndexWriter w = new IndexWriter(dir, iwc); for(int i=0;i<15000*RANDOM_MULTIPLIER;i++) { Document doc = new Document(); - doc.add(newTextField("id", random().nextLong() + "" + random().nextLong(), Field.Store.YES)); + // Uncompressible content so that merging 10 segments of size x creates a segment whose size is about 10x + byte[] idBytes = new byte[128]; + random().nextBytes(idBytes); + doc.add(new StoredField("id", idBytes)); w.addDocument(doc); } IndexReader r = DirectoryReader.open(w);