lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1210471 - in /lucene/dev/branches/branch_3x: ./ lucene/ lucene/src/java/org/apache/lucene/index/NormsWriter.java lucene/src/java/org/apache/lucene/index/SegmentReader.java
Date Mon, 05 Dec 2011 14:22:11 GMT
Author: rmuir
Date: Mon Dec  5 14:22:10 2011
New Revision: 1210471

URL: http://svn.apache.org/viewvc?rev=1210471&view=rev
Log:
LUCENE-3619: backport assertions from trunk

Modified:
    lucene/dev/branches/branch_3x/   (props changed)
    lucene/dev/branches/branch_3x/lucene/   (props changed)
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/NormsWriter.java
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/SegmentReader.java

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/NormsWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/NormsWriter.java?rev=1210471&r1=1210470&r2=1210471&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/NormsWriter.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/NormsWriter.java
Mon Dec  5 14:22:10 2011
@@ -164,7 +164,7 @@ final class NormsWriter extends Inverted
             normsOut.writeByte(defaultNorm);
         }
 
-        assert 4+normCount*state.numDocs == normsOut.getFilePointer() : ".nrm file size mismatch:
expected=" + (4+normCount*state.numDocs) + " actual=" + normsOut.getFilePointer();
+        assert 4+normCount*(long)state.numDocs == normsOut.getFilePointer() : ".nrm file
size mismatch: expected=" + (4+normCount*(long)state.numDocs) + " actual=" + normsOut.getFilePointer();
       }
       success = true;
     } finally {

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/SegmentReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/SegmentReader.java?rev=1210471&r1=1210470&r2=1210471&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/SegmentReader.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/SegmentReader.java
Mon Dec  5 14:22:10 2011
@@ -634,6 +634,7 @@ public class SegmentReader extends Index
   }
 
   private void openNorms(Directory cfsDir, int readBufferSize) throws IOException {
+    boolean normsInitiallyEmpty = norms.isEmpty(); // only used for assert
     long nextNormSeek = SegmentNorms.NORMS_HEADER.length; //skip header (header unused for
now)
     int maxDoc = maxDoc();
     for (int i = 0; i < core.fieldInfos.size(); i++) {
@@ -688,6 +689,7 @@ public class SegmentReader extends Index
         nextNormSeek += maxDoc; // increment also if some norms are separate
       }
     }
+    assert singleNormStream == null || !normsInitiallyEmpty || nextNormSeek == singleNormStream.length();
   }
 
   boolean termsIndexLoaded() {



Mime
View raw message