Apache Lucene open-source search software
LUCENE-3661: clean up how we handle the case of files outside of CFS
Robert Muir7a3542f16a30
diff --git a/lucene/src/java/org/apache/lucene/codecs/Codec.java b/lucene/src/java/org/apache/lucene/codecs/Codec.javaindex 5c134465510..3206a86a401 100644--- a/lucene/src/java/org/apache/lucene/codecs/Codec.java+++ b/lucene/src/java/org/apache/lucene/codecs/Codec.java@@ -54,6 +54,11 @@ public abstract class Codec implements NamedSPILoader.NamedSPI {normsFormat().files(dir, info, files);}+ public void separateFiles(Directory dir, SegmentInfo info, Set<String> files) throws IOException {+ liveDocsFormat().separateFiles(dir, info, files);+ normsFormat().separateFiles(dir, info, files);+ }+/** Encodes/decodes postings */public abstract PostingsFormat postingsFormat();diff --git a/lucene/src/java/org/apache/lucene/codecs/lucene40/BitVector.java b/lucene/src/java/org/apache/lucene/codecs/lucene40/BitVector.javaindex e26422500f9..b2fa3ec26a5 100644--- a/lucene/src/java/org/apache/lucene/codecs/lucene40/BitVector.java+++ b/lucene/src/java/org/apache/lucene/codecs/lucene40/BitVector.java@@ -39,7 +39,9 @@ import org.apache.lucene.util.MutableBits;** @lucene.internal*/-public final class BitVector implements Cloneable, MutableBits {+// pkg-private: if this thing is generally useful then it can go back in .util,+// but the serialization must be here underneath the codec.+final class BitVector implements Cloneable, MutableBits {private byte[] bits;private int size;diff --git a/lucene/src/java/org/apache/lucene/index/IndexWriter.java b/lucene/src/java/org/apache/lucene/index/IndexWriter.javaindex 2d0837b2863..2479fb04c0f 100644--- a/lucene/src/java/org/apache/lucene/index/IndexWriter.java+++ b/lucene/src/java/org/apache/lucene/index/IndexWriter.java@@ -4082,9 +4082,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit {Directory dir, SegmentInfo info) throws IOException {// maybe this is overkill, but codec naming clashes would be bad.Set<String> separateFiles = new HashSet<String>();- Codec codec = info.getCodec();- codec.normsFormat().separateFiles(dir, info, separateFiles);- codec.liveDocsFormat().separateFiles(dir, info, separateFiles);+ info.getCodec().separateFiles(dir, info, separateFiles);for (String file : files) {assert !separateFiles.contains(file) : file + " should not go in CFS!";diff --git a/lucene/src/java/org/apache/lucene/index/SegmentInfo.java b/lucene/src/java/org/apache/lucene/index/SegmentInfo.javaindex 824ba9d0abc..d3b3caeddff 100644--- a/lucene/src/java/org/apache/lucene/index/SegmentInfo.java+++ b/lucene/src/java/org/apache/lucene/index/SegmentInfo.java@@ -484,6 +484,9 @@ public final class SegmentInfo implements Cloneable {} else {codec.files(dir, this, fileSet);}++ // regardless of compound file setting: these files are always in the directory+ codec.separateFiles(dir, this, fileSet);if (docStoreOffset != -1) {// We are sharing doc stores (stored fields, term@@ -495,19 +498,6 @@ public final class SegmentInfo implements Cloneable {}}- // because deletions are stored outside CFS, we must check deletes here- // note: before the WTF logic was: delFileName != null && (hasDeletions() || fileExists(delFileName))...- if (hasDeletions()) {- codec.liveDocsFormat().separateFiles(dir, this, fileSet);- }-- // because separate norm files are unconditionally stored outside cfs,- // we must explicitly ask for their filenames if we might have separate norms:- // remove this when 3.x indexes are no longer supported- if (normGen != null) {- codec.normsFormat().separateFiles(dir, this, fileSet);- }-files = new ArrayList<String>(fileSet);return files;