Apache Solr open-source search software
LUCENE-1009: Fix merge slowdown with LogByteSizeMergePolicy when autoCommit=false and documents are using stored fields and/or term vectors
Michael McCandless8df6312a30ae
diff --git a/CHANGES.txt b/CHANGES.txtindex 97eb2678447..bac10f8c041 100644--- a/CHANGES.txt+++ b/CHANGES.txt@@ -119,6 +119,10 @@ Bug fixesThis bug was introduced with LUCENE-984. (Andi Vajda via MikeMcCandless)+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 features1. LUCENE-906: Elision filter for French.diff --git a/src/java/org/apache/lucene/index/IndexFileNames.java b/src/java/org/apache/lucene/index/IndexFileNames.javaindex c60df74644a..4c7cdbac165 100644--- a/src/java/org/apache/lucene/index/IndexFileNames.java+++ b/src/java/org/apache/lucene/index/IndexFileNames.java@@ -182,4 +182,16 @@ final class IndexFileNames {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;+ }}diff --git a/src/java/org/apache/lucene/index/SegmentInfo.java b/src/java/org/apache/lucene/index/SegmentInfo.javaindex 364efd51a6a..add7a93ceb8 100644--- a/src/java/org/apache/lucene/index/SegmentInfo.java+++ b/src/java/org/apache/lucene/index/SegmentInfo.java@@ -208,8 +208,13 @@ final class SegmentInfo {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;}