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 2011/11/11 05:04:44 UTC

svn commit: r1200729 - in /lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index: IndexWriter.java SegmentInfo.java

Author: rmuir
Date: Fri Nov 11 04:04:44 2011
New Revision: 1200729

URL: http://svn.apache.org/viewvc?rev=1200729&view=rev
Log:
LUCENE-2621: clear up nocommit

Modified:
    lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/IndexWriter.java
    lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/SegmentInfo.java

Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/IndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/IndexWriter.java?rev=1200729&r1=1200728&r2=1200729&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/IndexWriter.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/IndexWriter.java Fri Nov 11 04:04:44 2011
@@ -2594,7 +2594,6 @@ public class IndexWriter implements Clos
   }
   
   /** Copies the segment files as-is into the IndexWriter's directory. */
-  // nocommit: are we testing all the cases here?!
   private void copySegmentAsIs(SegmentInfo info, String segName,
       Map<String, String> dsNames, Set<String> dsFilesCopied, IOContext context)
       throws IOException {
@@ -2618,11 +2617,11 @@ public class IndexWriter implements Clos
       newDsName = segName;
     }
     
+    Set<String> codecDocStoreFiles = info.codecDocStoreFiles();
     // Copy the segment files
     for (String file: info.files()) {
       final String newFileName;
-      // nocommit: this method is slow!
-      if (info.isDocStoreFile(file)) {
+      if (codecDocStoreFiles.contains(file) || file.endsWith(IndexFileNames.COMPOUND_FILE_STORE_EXTENSION)) {
         newFileName = newDsName + IndexFileNames.stripSegmentName(file);
         if (dsFilesCopied.contains(newFileName)) {
           continue;

Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/SegmentInfo.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/SegmentInfo.java?rev=1200729&r1=1200728&r2=1200729&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/SegmentInfo.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/SegmentInfo.java Fri Nov 11 04:04:44 2011
@@ -331,11 +331,16 @@ public final class SegmentInfo implement
     }
   }
   
-  // TODO: a little messy, but sizeInBytes above that uses this is the real problem.
-  boolean isDocStoreFile(String fileName) throws IOException {
+  Set<String> codecDocStoreFiles() throws IOException {
     Set<String> docStoreFiles = new HashSet<String>();
     codec.storedFieldsFormat().files(dir, this, docStoreFiles);
     codec.termVectorsFormat().files(dir, this, docStoreFiles);
+    return docStoreFiles;
+  }
+
+  // TODO: a little messy, but sizeInBytes above that uses this is the real problem.
+  private boolean isDocStoreFile(String fileName) throws IOException {
+    Set<String> docStoreFiles = codecDocStoreFiles();
     return fileName.endsWith(IndexFileNames.COMPOUND_FILE_STORE_EXTENSION) || docStoreFiles.contains(fileName);
   }