mirror of https://github.com/apache/lucene.git
LUCENE-4055: remove redundant mergedDocCount
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene4055@1342009 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7508958f63
commit
1334bd6c15
|
@ -103,7 +103,7 @@ public abstract class DocValuesConsumer {
|
||||||
}
|
}
|
||||||
// only finish if no exception is thrown!
|
// only finish if no exception is thrown!
|
||||||
if (hasMerged) {
|
if (hasMerged) {
|
||||||
finish(mergeState.mergedDocCount);
|
finish(mergeState.segmentInfo.getDocCount());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ public abstract class TermsConsumer {
|
||||||
long sumTotalTermFreq = 0;
|
long sumTotalTermFreq = 0;
|
||||||
long sumDocFreq = 0;
|
long sumDocFreq = 0;
|
||||||
long sumDFsinceLastAbortCheck = 0;
|
long sumDFsinceLastAbortCheck = 0;
|
||||||
FixedBitSet visitedDocs = new FixedBitSet(mergeState.mergedDocCount);
|
FixedBitSet visitedDocs = new FixedBitSet(mergeState.segmentInfo.getDocCount());
|
||||||
|
|
||||||
IndexOptions indexOptions = mergeState.fieldInfo.getIndexOptions();
|
IndexOptions indexOptions = mergeState.fieldInfo.getIndexOptions();
|
||||||
if (indexOptions == IndexOptions.DOCS_ONLY) {
|
if (indexOptions == IndexOptions.DOCS_ONLY) {
|
||||||
|
|
|
@ -68,7 +68,7 @@ class FixedSortedBytesImpl {
|
||||||
throws IOException {
|
throws IOException {
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
final MergeContext ctx = SortedBytesMergeUtils.init(Type.BYTES_FIXED_SORTED, docValues, comp, mergeState.mergedDocCount);
|
final MergeContext ctx = SortedBytesMergeUtils.init(Type.BYTES_FIXED_SORTED, docValues, comp, mergeState.segmentInfo.getDocCount());
|
||||||
List<SortedSourceSlice> slices = SortedBytesMergeUtils.buildSlices(mergeState.docBase, mergeState.docMaps, docValues, ctx);
|
List<SortedSourceSlice> slices = SortedBytesMergeUtils.buildSlices(mergeState.docBase, mergeState.docMaps, docValues, ctx);
|
||||||
final IndexOutput datOut = getOrCreateDataOut();
|
final IndexOutput datOut = getOrCreateDataOut();
|
||||||
datOut.writeInt(ctx.sizePerValues);
|
datOut.writeInt(ctx.sizePerValues);
|
||||||
|
|
|
@ -71,7 +71,7 @@ final class VarSortedBytesImpl {
|
||||||
throws IOException {
|
throws IOException {
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
MergeContext ctx = SortedBytesMergeUtils.init(Type.BYTES_VAR_SORTED, docValues, comp, mergeState.mergedDocCount);
|
MergeContext ctx = SortedBytesMergeUtils.init(Type.BYTES_VAR_SORTED, docValues, comp, mergeState.segmentInfo.getDocCount());
|
||||||
final List<SortedSourceSlice> slices = SortedBytesMergeUtils.buildSlices(mergeState.docBase, mergeState.docMaps, docValues, ctx);
|
final List<SortedSourceSlice> slices = SortedBytesMergeUtils.buildSlices(mergeState.docBase, mergeState.docMaps, docValues, ctx);
|
||||||
IndexOutput datOut = getOrCreateDataOut();
|
IndexOutput datOut = getOrCreateDataOut();
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,6 @@ public class MergeState {
|
||||||
public List<IndexReaderAndLiveDocs> readers; // Readers & liveDocs being merged
|
public List<IndexReaderAndLiveDocs> readers; // Readers & liveDocs being merged
|
||||||
public int[][] docMaps; // Maps docIDs around deletions
|
public int[][] docMaps; // Maps docIDs around deletions
|
||||||
public int[] docBase; // New docID base per reader
|
public int[] docBase; // New docID base per reader
|
||||||
public int mergedDocCount; // Total # merged docs
|
|
||||||
public CheckAbort checkAbort;
|
public CheckAbort checkAbort;
|
||||||
public InfoStream infoStream;
|
public InfoStream infoStream;
|
||||||
|
|
||||||
|
|
|
@ -107,13 +107,11 @@ final class SegmentMerger {
|
||||||
// IndexWriter.close(false) takes to actually stop the
|
// IndexWriter.close(false) takes to actually stop the
|
||||||
// threads.
|
// threads.
|
||||||
|
|
||||||
// nocommit: can we nuke this count too?
|
mergeState.segmentInfo.setDocCount(setDocMaps());
|
||||||
mergeState.mergedDocCount = setDocMaps();
|
|
||||||
mergeState.segmentInfo.setDocCount(mergeState.mergedDocCount);
|
|
||||||
mergeDocValuesAndNormsFieldInfos();
|
mergeDocValuesAndNormsFieldInfos();
|
||||||
setMatchingSegmentReaders();
|
setMatchingSegmentReaders();
|
||||||
int numMerged = mergeFields();
|
int numMerged = mergeFields();
|
||||||
assert numMerged == mergeState.mergedDocCount;
|
assert numMerged == mergeState.segmentInfo.getDocCount();
|
||||||
|
|
||||||
final SegmentWriteState segmentWriteState = new SegmentWriteState(mergeState.infoStream, directory, mergeState.segmentInfo,
|
final SegmentWriteState segmentWriteState = new SegmentWriteState(mergeState.infoStream, directory, mergeState.segmentInfo,
|
||||||
mergeState.fieldInfos, termIndexInterval, null, context);
|
mergeState.fieldInfos, termIndexInterval, null, context);
|
||||||
|
@ -126,7 +124,7 @@ final class SegmentMerger {
|
||||||
|
|
||||||
if (mergeState.fieldInfos.hasVectors()) {
|
if (mergeState.fieldInfos.hasVectors()) {
|
||||||
numMerged = mergeVectors();
|
numMerged = mergeVectors();
|
||||||
assert numMerged == mergeState.mergedDocCount;
|
assert numMerged == mergeState.segmentInfo.getDocCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
// write the merged infos
|
// write the merged infos
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class TestSegmentMerger extends LuceneTestCase {
|
||||||
merger.add(reader1);
|
merger.add(reader1);
|
||||||
merger.add(reader2);
|
merger.add(reader2);
|
||||||
MergeState mergeState = merger.merge();
|
MergeState mergeState = merger.merge();
|
||||||
int docsMerged = mergeState.mergedDocCount;
|
int docsMerged = mergeState.segmentInfo.getDocCount();
|
||||||
assertTrue(docsMerged == 2);
|
assertTrue(docsMerged == 2);
|
||||||
//Should be able to open a new SegmentReader against the new directory
|
//Should be able to open a new SegmentReader against the new directory
|
||||||
SegmentReader mergedReader = new SegmentReader(new SegmentInfoPerCommit(
|
SegmentReader mergedReader = new SegmentReader(new SegmentInfoPerCommit(
|
||||||
|
|
Loading…
Reference in New Issue