lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1629106 - in /lucene/dev/branches/lucene5969/lucene: backward-codecs/src/java/org/apache/lucene/codecs/lucene40/ core/src/java/org/apache/lucene/codecs/ core/src/java/org/apache/lucene/codecs/lucene50/ core/src/java/org/apache/lucene/index/
Date Fri, 03 Oct 2014 03:17:56 GMT
Author: rmuir
Date: Fri Oct  3 03:17:55 2014
New Revision: 1629106

URL: http://svn.apache.org/r1629106
Log:
LUCENE-5969: clear nocommit

Modified:
    lucene/dev/branches/lucene5969/lucene/backward-codecs/src/java/org/apache/lucene/codecs/lucene40/Lucene40CompoundFormat.java
    lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/codecs/CompoundFormat.java
    lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50CompoundFormat.java
    lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/index/IndexFileNames.java
    lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java

Modified: lucene/dev/branches/lucene5969/lucene/backward-codecs/src/java/org/apache/lucene/codecs/lucene40/Lucene40CompoundFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/lucene/backward-codecs/src/java/org/apache/lucene/codecs/lucene40/Lucene40CompoundFormat.java?rev=1629106&r1=1629105&r2=1629106&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/lucene/backward-codecs/src/java/org/apache/lucene/codecs/lucene40/Lucene40CompoundFormat.java
(original)
+++ lucene/dev/branches/lucene5969/lucene/backward-codecs/src/java/org/apache/lucene/codecs/lucene40/Lucene40CompoundFormat.java
Fri Oct  3 03:17:55 2014
@@ -51,6 +51,14 @@ public final class Lucene40CompoundForma
     }
   }
   
+  @Override
+  public String[] files(SegmentInfo si) {
+    return new String[] {
+      IndexFileNames.segmentFileName(si.name, "", COMPOUND_FILE_EXTENSION),
+      IndexFileNames.segmentFileName(si.name, "", COMPOUND_FILE_ENTRIES_EXTENSION)
+    };
+  }
+  
   /** Extension of compound file */
   static final String COMPOUND_FILE_EXTENSION = "cfs";
   /** Extension of compound file entries */

Modified: lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/codecs/CompoundFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/codecs/CompoundFormat.java?rev=1629106&r1=1629105&r2=1629106&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/codecs/CompoundFormat.java
(original)
+++ lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/codecs/CompoundFormat.java
Fri Oct  3 03:17:55 2014
@@ -49,4 +49,8 @@ public abstract class CompoundFormat {
    */
   // TODO: get checkAbort out of here, and everywhere, and have iw do it at a higher level
   public abstract void write(Directory dir, SegmentInfo si, Collection<String> files,
CheckAbort checkAbort, IOContext context) throws IOException;
+  
+  // TODO: get this out of here, and use trackingdirwrapper. but this is really scary in
IW right now...
+  // NOTE: generally si.useCompoundFile is not even yet 'set' when this is called.
+  public abstract String[] files(SegmentInfo si);
 }

Modified: lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50CompoundFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50CompoundFormat.java?rev=1629106&r1=1629105&r2=1629106&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50CompoundFormat.java
(original)
+++ lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50CompoundFormat.java
Fri Oct  3 03:17:55 2014
@@ -103,7 +103,14 @@ public final class Lucene50CompoundForma
       CodecUtil.writeFooter(entries);
     }
   }
-  
+
+  @Override
+  public String[] files(SegmentInfo si) {
+    return new String[] {
+      IndexFileNames.segmentFileName(si.name, "", DATA_EXTENSION),
+      IndexFileNames.segmentFileName(si.name, "", ENTRIES_EXTENSION)
+    };
+  }
 
   /** Extension of compound file */
   static final String DATA_EXTENSION = "cfs";

Modified: lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/index/IndexFileNames.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/index/IndexFileNames.java?rev=1629106&r1=1629105&r2=1629106&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/index/IndexFileNames.java
(original)
+++ lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/index/IndexFileNames.java
Fri Oct  3 03:17:55 2014
@@ -53,12 +53,6 @@ public final class IndexFileNames {
   /** Name of the generation reference file name */
   public static final String OLD_SEGMENTS_GEN = "segments.gen";
 
-  /** Extension of compound file */
-  public static final String COMPOUND_FILE_EXTENSION = "cfs";
-  
-  /** Extension of compound file entries */
-  public static final String COMPOUND_FILE_ENTRIES_EXTENSION = "cfe";
-
   /**
    * Computes the full file name from base, extension and generation. If the
    * generation is -1, the file name is null. If it's 0, the file name is

Modified: lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java?rev=1629106&r1=1629105&r2=1629106&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
(original)
+++ lucene/dev/branches/lucene5969/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
Fri Oct  3 03:17:55 2014
@@ -3958,6 +3958,7 @@ public class IndexWriter implements Clos
       if (useCompoundFile) {
         success = false;
 
+        String cfsFiles[] = merge.info.info.getCodec().compoundFormat().files(merge.info.info);
         Collection<String> filesToRemove = merge.info.files();
 
         try {
@@ -3982,8 +3983,9 @@ public class IndexWriter implements Clos
             }
 
             synchronized(this) {
-              deleter.deleteFile(IndexFileNames.segmentFileName(mergedName, "", IndexFileNames.COMPOUND_FILE_EXTENSION));
-              deleter.deleteFile(IndexFileNames.segmentFileName(mergedName, "", IndexFileNames.COMPOUND_FILE_ENTRIES_EXTENSION));
+              for (String cfsFile : cfsFiles) {
+                deleter.deleteFile(cfsFile);
+              }
               deleter.deleteNewFiles(merge.info.files());
             }
           }
@@ -4004,8 +4006,9 @@ public class IndexWriter implements Clos
             if (infoStream.isEnabled("IW")) {
               infoStream.message("IW", "abort merge after building CFS");
             }
-            deleter.deleteFile(IndexFileNames.segmentFileName(mergedName, "", IndexFileNames.COMPOUND_FILE_EXTENSION));
-            deleter.deleteFile(IndexFileNames.segmentFileName(mergedName, "", IndexFileNames.COMPOUND_FILE_ENTRIES_EXTENSION));
+            for (String cfsFile : cfsFiles) {
+              deleter.deleteFile(cfsFile);
+            }
             return 0;
           }
         }
@@ -4452,10 +4455,9 @@ public class IndexWriter implements Clos
   static final Collection<String> createCompoundFile(InfoStream infoStream, Directory
directory, CheckAbort checkAbort, final SegmentInfo info, IOContext context)
           throws IOException {
 
-    // nocommit: use trackingdirectorywrapper instead to know which files to delete when
things fail:
-    String cfsFileName = IndexFileNames.segmentFileName(info.name, "", IndexFileNames.COMPOUND_FILE_EXTENSION);
-    String cfeFileName = IndexFileNames.segmentFileName(info.name, "", IndexFileNames.COMPOUND_FILE_ENTRIES_EXTENSION);
-
+    // TODO: use trackingdirectorywrapper instead of files() to know which files to delete
when things fail:
+    String cfsFiles[] = info.getCodec().compoundFormat().files(info);
+    
     if (infoStream.isEnabled("IW")) {
       infoStream.message("IW", "create compound file");
     }
@@ -4468,14 +4470,15 @@ public class IndexWriter implements Clos
       success = true;
     } finally {
       if (!success) {
-        IOUtils.deleteFilesIgnoringExceptions(directory, cfsFileName, cfeFileName);
+        IOUtils.deleteFilesIgnoringExceptions(directory, cfsFiles);
       }
     }
 
     // Replace all previous files with the CFS/CFE files:
     Set<String> siFiles = new HashSet<>();
-    siFiles.add(cfsFileName);
-    siFiles.add(cfeFileName);
+    for (String cfsFile : cfsFiles) {
+      siFiles.add(cfsFile);
+    };
     info.setFiles(siFiles);
 
     return files;



Mime
View raw message