LUCENE-1009: Fix merge slowdown with LogByteSizeMergePolicy when autoCommit=false and documents are using stored fields and/or term vectors

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@580646 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2007-09-29 21:22:35 +00:00
parent 8315089cdd
commit 8df6312a30
3 changed files with 23 additions and 2 deletions

View File

@ -119,6 +119,10 @@ Bug fixes
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.

View File

@ -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;
}
}

View File

@ -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;
}