lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r580646 - in /lucene/java/trunk: CHANGES.txt src/java/org/apache/lucene/index/IndexFileNames.java src/java/org/apache/lucene/index/SegmentInfo.java
Date Sat, 29 Sep 2007 21:22:36 GMT
Author: mikemccand
Date: Sat Sep 29 14:22:35 2007
New Revision: 580646

URL: http://svn.apache.org/viewvc?rev=580646&view=rev
Log:
LUCENE-1009: Fix merge slowdown with LogByteSizeMergePolicy when autoCommit=false and documents
are using stored fields and/or term vectors

Modified:
    lucene/java/trunk/CHANGES.txt
    lucene/java/trunk/src/java/org/apache/lucene/index/IndexFileNames.java
    lucene/java/trunk/src/java/org/apache/lucene/index/SegmentInfo.java

Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?rev=580646&r1=580645&r2=580646&view=diff
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Sat Sep 29 14:22:35 2007
@@ -119,6 +119,10 @@
     This bug was introduced with LUCENE-984.  (Andi Vajda via Mike
     McCandless)
 
+19. LUCENE-1009: Fix merge slowdown with LogByteSizeMergePolicy when
+    autoCommit=false and documents are using stored fields and/or term
+    vectors.  (Mark Miller via Mike McCandless)
+
 New features
 
  1. LUCENE-906: Elision filter for French.

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/IndexFileNames.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/IndexFileNames.java?rev=580646&r1=580645&r2=580646&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/IndexFileNames.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/IndexFileNames.java Sat Sep 29 14:22:35
2007
@@ -182,4 +182,16 @@
       return base + "_" + Long.toString(gen, Character.MAX_RADIX) + extension;
     }
   }
+
+  /**
+   * Returns true if the provided filename is one of the doc
+   * store files (ends with an extension in
+   * STORE_INDEX_EXTENSIONS).
+   */
+  static final boolean isDocStoreFile(String fileName) {
+    for(int i=0;i<STORE_INDEX_EXTENSIONS.length;i++)
+      if (fileName.endsWith(STORE_INDEX_EXTENSIONS[i]))
+        return true;
+    return false;
+  }
 }

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/SegmentInfo.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/SegmentInfo.java?rev=580646&r1=580645&r2=580646&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/SegmentInfo.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/SegmentInfo.java Sat Sep 29 14:22:35
2007
@@ -208,8 +208,13 @@
       List files = files();
       final int size = files.size();
       sizeInBytes = 0;
-      for(int i=0;i<size;i++) 
-        sizeInBytes += dir.fileLength((String) files.get(i));
+      for(int i=0;i<size;i++) {
+        final String fileName = (String) files.get(i);
+        // We don't count bytes used by a shared doc store
+        // against this segment:
+        if (docStoreOffset == -1 || !IndexFileNames.isDocStoreFile(fileName))
+          sizeInBytes += dir.fileLength(fileName);
+      }
     }
     return sizeInBytes;
   }



Mime
View raw message