You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rj...@apache.org on 2014/09/23 22:48:31 UTC

svn commit: r1627159 - in /lucene/dev/branches/branch_5x: ./ lucene/ lucene/CHANGES.txt lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java

Author: rjernst
Date: Tue Sep 23 20:48:31 2014
New Revision: 1627159

URL: http://svn.apache.org/r1627159
Log:
LUCENE-5974: Add check that backcompat indexes use default codecs (merged 1627158)

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/lucene/   (props changed)
    lucene/dev/branches/branch_5x/lucene/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_5x/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java

Modified: lucene/dev/branches/branch_5x/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/CHANGES.txt?rev=1627159&r1=1627158&r2=1627159&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/lucene/CHANGES.txt Tue Sep 23 20:48:31 2014
@@ -165,6 +165,9 @@ Tests
 * LUCENE-5957: Add option for tests to not randomize codec
   (Ryan Ernst)
 
+* LUCENE-5974: Add check that backcompat indexes use default codecs
+  (Ryan Ernst)
+
 Optimizations
 
 * LUCENE-5960: Use a more efficient bitset, not a Set<Integer>, to

Modified: lucene/dev/branches/branch_5x/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java?rev=1627159&r1=1627158&r2=1627159&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java (original)
+++ lucene/dev/branches/branch_5x/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java Tue Sep 23 20:48:31 2014
@@ -986,6 +986,24 @@ public class TestBackwardsCompatibility 
       r.close();
     }
   }
+
+  public void verifyUsesDefaultCodec(Directory dir, String name) throws Exception {
+    DirectoryReader r = DirectoryReader.open(dir);
+    for (AtomicReaderContext context : r.leaves()) {
+      SegmentReader air = (SegmentReader) context.reader();
+      Codec codec = air.getSegmentInfo().info.getCodec();
+      assertTrue("codec used in " + name + " (" + codec.getName() + ") is not a default codec (does not begin with Lucene)",
+                 codec.getName().startsWith("Lucene"));
+    }
+      r.close();
+  }
+  
+  public void testAllIndexesUseDefaultCodec() throws Exception {
+    for (String name : oldNames) {
+      Directory dir = oldIndexDirs.get(name);
+      verifyUsesDefaultCodec(dir, name);
+    }
+  }
   
   public void testNumericFields() throws Exception {
     for (String name : oldNames) {
@@ -1187,6 +1205,7 @@ public class TestBackwardsCompatibility 
     Path oldIndexDir = createTempDir("moreterms");
     TestUtil.unzip(getDataInputStream(moreTermsIndex), oldIndexDir);
     Directory dir = newFSDirectory(oldIndexDir);
+    verifyUsesDefaultCodec(dir, moreTermsIndex);
     // TODO: more tests
     TestUtil.checkIndex(dir);
     dir.close();
@@ -1226,6 +1245,7 @@ public class TestBackwardsCompatibility 
     Path oldIndexDir = createTempDir("dvupdates");
     TestUtil.unzip(getDataInputStream(dvUpdatesIndex), oldIndexDir);
     Directory dir = newFSDirectory(oldIndexDir);
+    verifyUsesDefaultCodec(dir, dvUpdatesIndex);
     
     verifyDocValues(dir);