lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r834213 - /lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/SimpleStandardTermsIndexReader.java
Date Mon, 09 Nov 2009 20:17:53 GMT
Author: mikemccand
Date: Mon Nov  9 20:17:53 2009
New Revision: 834213

URL: http://svn.apache.org/viewvc?rev=834213&view=rev
Log:
LUCENE-1458 (on flex branch): fixed bug that was still using too much memory to hold terms
dict index

Modified:
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/SimpleStandardTermsIndexReader.java

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/SimpleStandardTermsIndexReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/SimpleStandardTermsIndexReader.java?rev=834213&r1=834212&r2=834213&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/SimpleStandardTermsIndexReader.java
(original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/SimpleStandardTermsIndexReader.java
Mon Nov  9 20:17:53 2009
@@ -135,24 +135,22 @@
    * its actual usagee.  This substantially reduces memory
    * usage of SegmentReader searching a tiny segment. */
   private final void trimByteBlock() {
-    if (blockUpto != 0) {
-      if (blockOffset == 0) {
-        // nocommit -- should not happen?  fields w/ no terms
-        // are not written by STDW.  hmmm it does
-        // happen... must explain why -- oh, could be only
-        // on exception; I added only calling this on
-        // success above
-        // assert false;
-        // nocommit -- hit AIOOBE here (blocks is length 0):
-        //blocks[blockUpto] = null;
-        System.out.println("Simple terms index consumed no bytes! blockCount=" + blocks.length);
-      } else {
-        byte[] last = new byte[blockOffset];
-        System.arraycopy(blocks[blockUpto], 0, last, 0, blockOffset);
-        blocks[blockUpto] = last;
+    if (blockOffset == 0) {
+      // nocommit -- should not happen?  fields w/ no terms
+      // are not written by STDW.  hmmm it does
+      // happen... must explain why -- oh, could be only
+      // on exception; I added only calling this on
+      // success above
+      //assert false;
+      // nocommit -- hit AIOOBE here (blocks is length 0):
+      if (blocks != null) {
+        blocks[blockUpto] = null;
       }
+      //System.out.println("Simple terms index consumed no bytes! blockCount=" + blocks.length);
     } else {
-      // nocommit -- we shouldn't get here, but we do -- fix it!
+      byte[] last = new byte[blockOffset];
+      System.arraycopy(blocks[blockUpto], 0, last, 0, blockOffset);
+      blocks[blockUpto] = last;
     }
   }
 
@@ -171,6 +169,8 @@
 
   // nocommit -- is this big enough, given max allowed term
   // size (measured in chars!!) ?
+  // nocommit -- or, we could allocate one block way to big,
+  // to accommodate such ridiculous terms
   private static final int BYTE_BLOCK_SHIFT = 15;
   private static final int BYTE_BLOCK_SIZE = 1 << BYTE_BLOCK_SHIFT;
   private static final int BYTE_BLOCK_MASK = BYTE_BLOCK_SIZE - 1;
@@ -299,9 +299,6 @@
         blockPointer = new long[this.numIndexTerms];
         termLength = new short[this.numIndexTerms];
         
-        // nocommit: unused?
-        //final DeltaBytesReader bytesReader = new DeltaBytesReader(clone);
-
         final byte[] skipBytes;
         if (indexDivisor != 1) {
           // only need skipBytes (below) if we are not



Mime
View raw message