lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sim...@apache.org
Subject svn commit: r1144278 - /lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/DocFieldProcessor.java
Date Fri, 08 Jul 2011 12:09:32 GMT
Author: simonw
Date: Fri Jul  8 12:09:32 2011
New Revision: 1144278

URL: http://svn.apache.org/viewvc?rev=1144278&view=rev
Log:
close PerDocConsumer during flush to ensure all files are written in the CFS case 

Modified:
    lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/DocFieldProcessor.java

Modified: lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/DocFieldProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/DocFieldProcessor.java?rev=1144278&r1=1144277&r2=1144278&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/DocFieldProcessor.java (original)
+++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/DocFieldProcessor.java Fri Jul
 8 12:09:32 2011
@@ -32,6 +32,7 @@ import org.apache.lucene.index.codecs.Co
 import org.apache.lucene.index.codecs.PerDocConsumer;
 import org.apache.lucene.index.codecs.DocValuesConsumer;
 import org.apache.lucene.util.ArrayUtil;
+import org.apache.lucene.util.IOUtils;
 
 
 /**
@@ -87,6 +88,8 @@ final class DocFieldProcessor extends Do
     for (DocValuesConsumer consumers : docValues.values()) {
       consumers.finish(state.numDocs);
     };
+    // close perDocConsumer during flush to ensure all files are flushed due to PerCodec
CFS
+    IOUtils.closeSafely(true, perDocConsumers.values());
   }
 
   @Override
@@ -106,13 +109,11 @@ final class DocFieldProcessor extends Do
         field = next;
       }
     }
-    
-    for(PerDocConsumer consumer : perDocConsumers.values()) {
-      try {
-        consumer.close();  // TODO add abort to PerDocConsumer!
-      } catch (IOException e) {
-        // ignore on abort!
-      }
+    try {
+      IOUtils.closeSafely(true, perDocConsumers.values());
+      // TODO add abort to PerDocConsumer!
+    } catch (IOException e) {
+      // ignore on abort!
     }
     
     try {
@@ -165,13 +166,6 @@ final class DocFieldProcessor extends Do
     fieldHash = new DocFieldProcessorPerField[2];
     hashMask = 1;
     totalFieldCount = 0;
-    for(PerDocConsumer consumer : perDocConsumers.values()) {
-      try {
-        consumer.close();  
-      } catch (IOException e) {
-        // ignore and continue closing remaining consumers
-      }
-    }
     perDocConsumers.clear();
     docValues.clear();
   }



Mime
View raw message