You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ho...@apache.org on 2019/05/09 18:41:10 UTC

[lucene-solr] branch branch_8x updated: minimize randomization of IndexWriterConfig in TestDocTermOrdsUninvertLimit to reduce risk of OOM in nightly tests

This is an automated email from the ASF dual-hosted git repository.

hossman pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8x by this push:
     new 786f5fc  minimize randomization of IndexWriterConfig in TestDocTermOrdsUninvertLimit to reduce risk of OOM in nightly tests
     new 20e261c  Merge remote-tracking branch 'refs/remotes/origin/branch_8x' into branch_8x
786f5fc is described below

commit 786f5fc359127c2ac1f6ea4535501f93dba5d579
Author: Chris Hostetter <ho...@apache.org>
AuthorDate: Thu May 9 11:34:43 2019 -0700

    minimize randomization of IndexWriterConfig in TestDocTermOrdsUninvertLimit to reduce risk of OOM in nightly tests
    
    (cherry picked from commit 5e40000e273b861c733bd220c0fc8fd3e3e359b0)
---
 .../uninverting/TestDocTermOrdsUninvertLimit.java   | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/solr/core/src/test/org/apache/solr/uninverting/TestDocTermOrdsUninvertLimit.java b/solr/core/src/test/org/apache/solr/uninverting/TestDocTermOrdsUninvertLimit.java
index 81e8c7b..b3cad62 100644
--- a/solr/core/src/test/org/apache/solr/uninverting/TestDocTermOrdsUninvertLimit.java
+++ b/solr/core/src/test/org/apache/solr/uninverting/TestDocTermOrdsUninvertLimit.java
@@ -22,9 +22,12 @@ import java.io.IOException;
 import org.apache.lucene.analysis.MockAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
+import org.apache.lucene.index.ConcurrentMergeScheduler;
+import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.LeafReader;
-import org.apache.lucene.index.RandomIndexWriter;
+import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.store.Directory;
 import org.apache.solr.SolrTestCase;
 import org.apache.lucene.util.TestUtil;
@@ -46,11 +49,17 @@ public class TestDocTermOrdsUninvertLimit extends SolrTestCase {
     final int DOCS = (1<<16)-1;                  // The number of documents within a single pass (simplified)
     final int TERMS = REF_LIMIT/DOCS;            // Each document must have this many references aka terms hit limit
 
-    // disk based Directory to reduce risk of OOM
+    // disk based Directory and IWC settings to reduce risk of OOM
     Directory dir = newFSDirectory(createTempDir("TestDocTermOrdsUninvertLimit"));
+    final IndexWriter w = new IndexWriter(dir,
+                                          new IndexWriterConfig(new MockAnalyzer(random()))
+                                          .setMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH)
+                                          .setRAMBufferSizeMB(256.0)
+                                          .setMergeScheduler(new ConcurrentMergeScheduler())
+                                          .setMergePolicy(newLogMergePolicy(false, 10))
+                                          .setOpenMode(IndexWriterConfig.OpenMode.CREATE)
+                                          .setCodec(TestUtil.getDefaultCodec()));
     
-    final RandomIndexWriter w = new RandomIndexWriter(random(), dir,
-        newIndexWriterConfig(new MockAnalyzer(random())).setMergePolicy(newLogMergePolicy()));
     Document doc = new Document();
     Field field = newTextField("field", "", Field.Store.NO);
     doc.add(field);
@@ -65,9 +74,9 @@ public class TestDocTermOrdsUninvertLimit extends SolrTestCase {
       w.addDocument(doc);
     }
     //System.out.println("\n Finished adding " + DOCS + " documents of " + TERMS + " unique terms");
-    final IndexReader r = w.getReader();
     w.close();
-
+    
+    final IndexReader r = DirectoryReader.open(dir);
     try {
       final LeafReader ar = SlowCompositeReaderWrapper.wrap(r);
       TestUtil.checkReader(ar);