You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2012/01/29 14:18:16 UTC

svn commit: r1237280 - in /lucene/dev/branches/lucene3661/lucene/src/java/org/apache/lucene: codecs/lucene3x/Lucene3xCodec.java index/SegmentInfo.java

Author: rmuir
Date: Sun Jan 29 13:18:16 2012
New Revision: 1237280

URL: http://svn.apache.org/viewvc?rev=1237280&view=rev
Log:
LUCENE-3728: 3.x codec files() privately adds compound docstores

Modified:
    lucene/dev/branches/lucene3661/lucene/src/java/org/apache/lucene/codecs/lucene3x/Lucene3xCodec.java
    lucene/dev/branches/lucene3661/lucene/src/java/org/apache/lucene/index/SegmentInfo.java

Modified: lucene/dev/branches/lucene3661/lucene/src/java/org/apache/lucene/codecs/lucene3x/Lucene3xCodec.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3661/lucene/src/java/org/apache/lucene/codecs/lucene3x/Lucene3xCodec.java?rev=1237280&r1=1237279&r2=1237280&view=diff
==============================================================================
--- lucene/dev/branches/lucene3661/lucene/src/java/org/apache/lucene/codecs/lucene3x/Lucene3xCodec.java (original)
+++ lucene/dev/branches/lucene3661/lucene/src/java/org/apache/lucene/codecs/lucene3x/Lucene3xCodec.java Sun Jan 29 13:18:16 2012
@@ -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
+    }
   }
   
 }

Modified: lucene/dev/branches/lucene3661/lucene/src/java/org/apache/lucene/index/SegmentInfo.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3661/lucene/src/java/org/apache/lucene/index/SegmentInfo.java?rev=1237280&r1=1237279&r2=1237280&view=diff
==============================================================================
--- lucene/dev/branches/lucene3661/lucene/src/java/org/apache/lucene/index/SegmentInfo.java (original)
+++ lucene/dev/branches/lucene3661/lucene/src/java/org/apache/lucene/index/SegmentInfo.java Sun Jan 29 13:18:16 2012
@@ -477,16 +477,6 @@ public final class SegmentInfo implement
     // 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;