Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

LUCENE-3728: 3.x codec files() privately adds compound docstores

Robert Muir8d98a6d270a1
diff --git a/lucene/src/java/org/apache/lucene/codecs/lucene3x/Lucene3xCodec.java b/lucene/src/java/org/apache/lucene/codecs/lucene3x/Lucene3xCodec.java
index cd43942e2d0..0bb9296b456 100644
--- a/lucene/src/java/org/apache/lucene/codecs/lucene3x/Lucene3xCodec.java
+++ b/lucene/src/java/org/apache/lucene/codecs/lucene3x/Lucene3xCodec.java
@@ -131,10 +131,9 @@ public class Lucene3xCodec extends Codec {
return liveDocsFormat;
}
- // overrides the default implementation in codec.java to handle CFS without CFE, and shared docstores
+ // overrides the default implementation in codec.java to handle CFS without CFE
@Override
public void files(Directory dir, SegmentInfo info, Set<String> files) throws IOException {
- // TODO: shared doc stores
if (info.getUseCompoundFile()) {
files.add(IndexFileNames.segmentFileName(info.name, "", IndexFileNames.COMPOUND_FILE_EXTENSION));
// NOTE: we don't add the CFE extension: because 3.x format doesn't use it.
@@ -143,11 +142,20 @@ public class Lucene3xCodec extends Codec {
}
}
- // override the default implementation in codec.java to handle separate norms files
+ // override the default implementation in codec.java to handle separate norms files, and shared compound docstores
@Override
public void separateFiles(Directory dir, SegmentInfo info, Set<String> files) throws IOException {
super.separateFiles(dir, info, files);
normsFormat().separateFiles(dir, info, files);
+ if (info.getDocStoreOffset() != -1) {
+ // We are sharing doc stores (stored fields, term
+ // vectors) with other segments
+ assert info.getDocStoreSegment() != null;
+ if (info.getDocStoreIsCompoundFile()) {
+ files.add(IndexFileNames.segmentFileName(info.getDocStoreSegment(), "", IndexFileNames.COMPOUND_FILE_STORE_EXTENSION));
+ }
+ // otherwise, if its not a compound docstore, storedfieldsformat/termvectorsformat are each adding their relevant files
+ }
}
}
diff --git a/lucene/src/java/org/apache/lucene/index/SegmentInfo.java b/lucene/src/java/org/apache/lucene/index/SegmentInfo.java
index 72fbafb9435..0ab77246757 100644
--- a/lucene/src/java/org/apache/lucene/index/SegmentInfo.java
+++ b/lucene/src/java/org/apache/lucene/index/SegmentInfo.java
@@ -477,16 +477,6 @@ public final class SegmentInfo implements Cloneable {
// 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
- // vectors) with other segments
- assert docStoreSegment != null;
- // TODO: push this out into preflex fieldsFormat?
- if (docStoreIsCompoundFile) {
- fileSet.add(IndexFileNames.segmentFileName(docStoreSegment, "", IndexFileNames.COMPOUND_FILE_STORE_EXTENSION));
- }
- }
-
files = new ArrayList<String>(fileSet);
return files;