Apache Lucene open-source search software
LUCENE-5646: Remove rare/undertested bulk merge algorithm in CompressingStoredFieldsWriter
Robert Muir07d9fd7bd35b
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex e77b775be7c..60ce042330c 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -84,6 +84,9 @@ Changes in Runtime BehaviorIndexWriter will now throw IllegalArgumentException. (Robert Muir,Mike McCandless)+* LUCENE-5646: Remove rare/undertested bulk merge algorithm in+ CompressingStoredFieldsWriter. (Robert Muir, Adrien Grand)+New Features* LUCENE-5610: Add Terms.getMin and Terms.getMax to get the lowest anddiff --git a/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingStoredFieldsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingStoredFieldsReader.javaindex f63468ef147..a2f5862828c 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingStoredFieldsReader.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingStoredFieldsReader.java@@ -505,17 +505,6 @@ public final class CompressingStoredFieldsReader extends StoredFieldsReader {}}- /**- * Copy compressed data.- */- void copyCompressedData(DataOutput out) throws IOException {- assert getVersion() == VERSION_CURRENT;- final long chunkEnd = docBase + chunkDocs == numDocs- ? maxPointer- : indexReader.getStartPointer(docBase + chunkDocs);- out.copyBytes(fieldsStream, chunkEnd - fieldsStream.getFilePointer());- }-/*** Check integrity of the data. The iterator is not usable after this method has been called.*/diff --git a/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingStoredFieldsWriter.java b/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingStoredFieldsWriter.javaindex 32785c4f1e7..5430a5063d1 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingStoredFieldsWriter.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingStoredFieldsWriter.java@@ -374,36 +374,20 @@ public final class CompressingStoredFieldsWriter extends StoredFieldsWriter {startOffsets[i] = startOffsets[i - 1] + it.lengths[i - 1];}- if (numBufferedDocs == 0 // starting a new chunk- && startOffsets[it.chunkDocs - 1] < chunkSize // chunk is small enough- && startOffsets[it.chunkDocs - 1] + it.lengths[it.chunkDocs - 1] >= chunkSize // chunk is large enough- && nextDeletedDoc(it.docBase, liveDocs, it.docBase + it.chunkDocs) == it.docBase + it.chunkDocs) { // no deletion in the chunk- assert docID == it.docBase;-- // no need to decompress, just copy data- indexWriter.writeIndex(it.chunkDocs, fieldsStream.getFilePointer());- writeHeader(this.docBase, it.chunkDocs, it.numStoredFields, it.lengths);- it.copyCompressedData(fieldsStream);- this.docBase += it.chunkDocs;- docID = nextLiveDoc(it.docBase + it.chunkDocs, liveDocs, maxDoc);- docCount += it.chunkDocs;- mergeState.checkAbort.work(300 * it.chunkDocs);- } else {- // decompress- it.decompress();- if (startOffsets[it.chunkDocs - 1] + it.lengths[it.chunkDocs - 1] != it.bytes.length) {- throw new CorruptIndexException("Corrupted: expected chunk size=" + startOffsets[it.chunkDocs - 1] + it.lengths[it.chunkDocs - 1] + ", got " + it.bytes.length);- }- // copy non-deleted docs- for (; docID < it.docBase + it.chunkDocs; docID = nextLiveDoc(docID + 1, liveDocs, maxDoc)) {- final int diff = docID - it.docBase;- startDocument();- bufferedDocs.writeBytes(it.bytes.bytes, it.bytes.offset + startOffsets[diff], it.lengths[diff]);- numStoredFieldsInDoc = it.numStoredFields[diff];- finishDocument();- ++docCount;- mergeState.checkAbort.work(300);- }+ // decompress+ it.decompress();+ if (startOffsets[it.chunkDocs - 1] + it.lengths[it.chunkDocs - 1] != it.bytes.length) {+ throw new CorruptIndexException("Corrupted: expected chunk size=" + startOffsets[it.chunkDocs - 1] + it.lengths[it.chunkDocs - 1] + ", got " + it.bytes.length);+ }+ // copy non-deleted docs+ for (; docID < it.docBase + it.chunkDocs; docID = nextLiveDoc(docID + 1, liveDocs, maxDoc)) {+ final int diff = docID - it.docBase;+ startDocument();+ bufferedDocs.writeBytes(it.bytes.bytes, it.bytes.offset + startOffsets[diff], it.lengths[diff]);+ numStoredFieldsInDoc = it.numStoredFields[diff];+ finishDocument();+ ++docCount;+ mergeState.checkAbort.work(300);}} while (docID < maxDoc);@@ -424,15 +408,4 @@ public final class CompressingStoredFieldsWriter extends StoredFieldsWriter {}return doc;}-- private static int nextDeletedDoc(int doc, Bits liveDocs, int maxDoc) {- if (liveDocs == null) {- return maxDoc;- }- while (doc < maxDoc && liveDocs.get(doc)) {- ++doc;- }- return doc;- }-}