You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2018/05/15 20:04:20 UTC

[03/39] lucene-solr:jira/solr-11779: LUCENE-8267: removed references to memory codecs.

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/85c00e77/solr/core/src/test/org/apache/solr/core/TestCodecSupport.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/core/TestCodecSupport.java b/solr/core/src/test/org/apache/solr/core/TestCodecSupport.java
index bdef535f..146a0f0 100644
--- a/solr/core/src/test/org/apache/solr/core/TestCodecSupport.java
+++ b/solr/core/src/test/org/apache/solr/core/TestCodecSupport.java
@@ -63,9 +63,8 @@ public class TestCodecSupport extends SolrTestCaseJ4 {
     SchemaField schemaField = fields.get("string_disk_f");
     PerFieldDocValuesFormat format = (PerFieldDocValuesFormat) codec.docValuesFormat();
     assertEquals(TestUtil.getDefaultDocValuesFormat().getName(), format.getDocValuesFormatForField(schemaField.getName()).getName());
-    schemaField = fields.get("string_memory_f");
-    assertEquals("Memory",
-        format.getDocValuesFormatForField(schemaField.getName()).getName());
+    schemaField = fields.get("string_direct_f");
+    assertEquals("Direct", format.getDocValuesFormatForField(schemaField.getName()).getName());
     schemaField = fields.get("string_f");
     assertEquals(TestUtil.getDefaultDocValuesFormat().getName(),
         format.getDocValuesFormatForField(schemaField.getName()).getName());
@@ -87,8 +86,8 @@ public class TestCodecSupport extends SolrTestCaseJ4 {
 
     assertEquals(TestUtil.getDefaultDocValuesFormat().getName(), format.getDocValuesFormatForField("foo_disk").getName());
     assertEquals(TestUtil.getDefaultDocValuesFormat().getName(), format.getDocValuesFormatForField("bar_disk").getName());
-    assertEquals("Memory", format.getDocValuesFormatForField("foo_memory").getName());
-    assertEquals("Memory", format.getDocValuesFormatForField("bar_memory").getName());
+    assertEquals("Direct", format.getDocValuesFormatForField("foo_direct").getName());
+    assertEquals("Direct", format.getDocValuesFormatForField("bar_direct").getName());
   }
   
   private void reloadCoreAndRecreateIndex() {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/85c00e77/solr/core/src/test/org/apache/solr/search/function/TestMinMaxOnMultiValuedField.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/function/TestMinMaxOnMultiValuedField.java b/solr/core/src/test/org/apache/solr/search/function/TestMinMaxOnMultiValuedField.java
index 29fd8dc..f273ba5 100644
--- a/solr/core/src/test/org/apache/solr/search/function/TestMinMaxOnMultiValuedField.java
+++ b/solr/core/src/test/org/apache/solr/search/function/TestMinMaxOnMultiValuedField.java
@@ -40,7 +40,7 @@ import org.junit.BeforeClass;
  * Tests the behavior of <code>field(foo,min|max)</code> on numerious types of multivalued 'foo' fields,
  * as well as the beahvior of sorting on <code>foo asc|desc</code> to implicitly choose the min|max.
  */
-@SuppressCodecs({"Memory", "SimpleText"}) // see TestSortedSetSelector
+@SuppressCodecs({"SimpleText"}) // see TestSortedSetSelector
 public class TestMinMaxOnMultiValuedField extends SolrTestCaseJ4 {
 
   /** Initializes core and does some sanity checking of schema */

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/85c00e77/solr/core/src/test/org/apache/solr/search/function/TestSortByMinMaxFunction.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/function/TestSortByMinMaxFunction.java b/solr/core/src/test/org/apache/solr/search/function/TestSortByMinMaxFunction.java
index 5475b59..bf898f2 100644
--- a/solr/core/src/test/org/apache/solr/search/function/TestSortByMinMaxFunction.java
+++ b/solr/core/src/test/org/apache/solr/search/function/TestSortByMinMaxFunction.java
@@ -24,7 +24,7 @@ import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
  *
  * @see SortByFunctionTest
  **/
-@SuppressCodecs({"Memory", "SimpleText"}) // see TestSortedSetSelector
+@SuppressCodecs({"SimpleText"}) // see TestSortedSetSelector
 public class TestSortByMinMaxFunction extends SortByFunctionTest {
 
   @Override

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/85c00e77/solr/core/src/test/org/apache/solr/uninverting/TestDocTermOrdsUninvertLimit.java
----------------------------------------------------------------------
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 af66b42..a9678a8 100644
--- a/solr/core/src/test/org/apache/solr/uninverting/TestDocTermOrdsUninvertLimit.java
+++ b/solr/core/src/test/org/apache/solr/uninverting/TestDocTermOrdsUninvertLimit.java
@@ -30,7 +30,6 @@ import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.TestUtil;
 import org.apache.solr.index.SlowCompositeReaderWrapper;
 
-@LuceneTestCase.SuppressCodecs({"Memory"})
 public class TestDocTermOrdsUninvertLimit extends LuceneTestCase {
 
   /* UnInvertedField had a reference block limitation of 2^24. This unit test triggered it.

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/85c00e77/solr/core/src/test/org/apache/solr/uninverting/TestFieldCacheVsDocValues.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/uninverting/TestFieldCacheVsDocValues.java b/solr/core/src/test/org/apache/solr/uninverting/TestFieldCacheVsDocValues.java
index 9bacab6..0377dff 100644
--- a/solr/core/src/test/org/apache/solr/uninverting/TestFieldCacheVsDocValues.java
+++ b/solr/core/src/test/org/apache/solr/uninverting/TestFieldCacheVsDocValues.java
@@ -165,38 +165,11 @@ public class TestFieldCacheVsDocValues extends LuceneTestCase {
           b.length = bytes.length;
           doc.add(new BinaryDocValuesField("field", b));
           doc.add(new StringField("id", "" + docID, Field.Store.YES));
-          try {
-            w.addDocument(doc);
-          } catch (IllegalArgumentException iae) {
-            if (iae.getMessage().indexOf("is too large") == -1) {
-              throw iae;
-            } else {
-              // OK: some codecs can't handle binary DV > 32K
-              assertFalse(codecAcceptsHugeBinaryValues("field"));
-              w.rollback();
-              d.close();
-              return;
-            }
-          }
+          w.addDocument(doc);
         }
 
 
-        DirectoryReader r;
-        try {
-          r = DirectoryReader.open(w);
-        } catch (IllegalArgumentException iae) {
-          if (iae.getMessage().indexOf("is too large") == -1) {
-            throw iae;
-          } else {
-            assertFalse(codecAcceptsHugeBinaryValues("field"));
-
-            // OK: some codecs can't handle binary DV > 32K
-            w.rollback();
-            d.close();
-            return;
-          }
-        }
-
+        DirectoryReader r = DirectoryReader.open(w);
 
         try (LeafReader ar = SlowCompositeReaderWrapper.wrap(r)) {
           TestUtil.checkReader(ar);
@@ -210,86 +183,11 @@ public class TestFieldCacheVsDocValues extends LuceneTestCase {
             assertEquals(expected.length, bytes.length);
             assertEquals(new BytesRef(expected), bytes);
           }
-
-          assertTrue(codecAcceptsHugeBinaryValues("field"));
         }
       }
     }
   }
 
-  private static final int LARGE_BINARY_FIELD_LENGTH = (1 << 15) - 2;
-
-  // TODO: get this out of here and into the deprecated codecs (4.0, 4.2)
-  public void testHugeBinaryValueLimit() throws Exception {
-    // We only test DVFormats that have a limit
-    assumeFalse("test requires codec with limits on max binary field length", codecAcceptsHugeBinaryValues("field"));
-    Analyzer analyzer = new MockAnalyzer(random());
-    // FSDirectory because SimpleText will consume gobbs of
-    // space when storing big binary values:
-    Directory d = newFSDirectory(createTempDir("hugeBinaryValues"));
-    boolean doFixed = random().nextBoolean();
-    int numDocs;
-    int fixedLength = 0;
-    if (doFixed) {
-      // Sometimes make all values fixed length since some
-      // codecs have different code paths for this:
-      numDocs = TestUtil.nextInt(random(), 10, 20);
-      fixedLength = LARGE_BINARY_FIELD_LENGTH;
-    } else {
-      numDocs = TestUtil.nextInt(random(), 100, 200);
-    }
-    IndexWriter w = new IndexWriter(d, newIndexWriterConfig(analyzer));
-    List<byte[]> docBytes = new ArrayList<>();
-    long totalBytes = 0;
-    for(int docID=0;docID<numDocs;docID++) {
-      // we don't use RandomIndexWriter because it might add
-      // more docvalues than we expect !!!!
-
-      // Must be > 64KB in size to ensure more than 2 pages in
-      // PagedBytes would be needed:
-      int numBytes;
-      if (doFixed) {
-        numBytes = fixedLength;
-      } else if (docID == 0 || random().nextInt(5) == 3) {
-        numBytes = LARGE_BINARY_FIELD_LENGTH;
-      } else {
-        numBytes = TestUtil.nextInt(random(), 1, LARGE_BINARY_FIELD_LENGTH);
-      }
-      totalBytes += numBytes;
-      if (totalBytes > 5 * 1024*1024) {
-        break;
-      }
-      byte[] bytes = new byte[numBytes];
-      random().nextBytes(bytes);
-      docBytes.add(bytes);
-      Document doc = new Document();      
-      BytesRef b = new BytesRef(bytes);
-      b.length = bytes.length;
-      doc.add(new BinaryDocValuesField("field", b));
-      doc.add(new StringField("id", ""+docID, Field.Store.YES));
-      w.addDocument(doc);
-    }
-    
-    DirectoryReader r = DirectoryReader.open(w);
-    w.close();
-
-    LeafReader ar = SlowCompositeReaderWrapper.wrap(r);
-    TestUtil.checkReader(ar);
-
-    BinaryDocValues s = FieldCache.DEFAULT.getTerms(ar, "field");
-    for(int docID=0;docID<docBytes.size();docID++) {
-      assertEquals(docID, s.nextDoc());
-      Document doc = ar.document(docID);
-      BytesRef bytes = s.binaryValue();
-      byte[] expected = docBytes.get(Integer.parseInt(doc.get("id")));
-      assertEquals(expected.length, bytes.length);
-      assertEquals(new BytesRef(expected), bytes);
-    }
-
-    ar.close();
-    d.close();
-  }
-  
   private void doTestSortedVsFieldCache(int minLength, int maxLength) throws Exception {
     Directory dir = newDirectory();
     IndexWriterConfig conf = newIndexWriterConfig(new MockAnalyzer(random()));
@@ -616,9 +514,4 @@ public class TestFieldCacheVsDocValues extends LuceneTestCase {
       }
     }
   }
-  
-  protected boolean codecAcceptsHugeBinaryValues(String field) {
-    String name = TestUtil.getDocValuesFormat(field);
-    return !(name.equals("Memory")); // Direct has a different type of limit
-  }
 }