accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject svn commit: r1300875 - /incubator/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormat.java
Date Thu, 15 Mar 2012 10:07:40 GMT
Author: vines
Date: Thu Mar 15 10:07:40 2012
New Revision: 1300875

URL: http://svn.apache.org/viewvc?rev=1300875&view=rev
Log:
ACCUMULO-146 - RFile Writer is not made until first write.


Modified:
    incubator/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormat.java

Modified: incubator/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormat.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormat.java?rev=1300875&r1=1300874&r2=1300875&view=diff
==============================================================================
--- incubator/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormat.java
(original)
+++ incubator/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormat.java
Thu Mar 15 10:07:40 2012
@@ -64,24 +64,21 @@ public class AccumuloFileOutputFormat ex
     handleBlockSize(job.getConfiguration());
     final Path file = this.getDefaultWorkFile(job, "." + extension);
     
-    final FileSKVWriter out = FileOperations.getInstance().openWriter(file.toString(), file.getFileSystem(conf),
conf,
-        AccumuloConfiguration.getDefaultConfiguration());
-    out.startDefaultLocalityGroup();
-    
     return new RecordWriter<Key,Value>() {
-      private boolean hasData = false;
+      FileSKVWriter out = null;
       
       @Override
       public void write(Key key, Value value) throws IOException {
+        if (out == null) {
+          out = FileOperations.getInstance().openWriter(file.toString(), file.getFileSystem(conf),
conf, AccumuloConfiguration.getDefaultConfiguration());
+          out.startDefaultLocalityGroup();
+        }
         out.append(key, value);
-        hasData = true;
       }
       
       @Override
       public void close(TaskAttemptContext context) throws IOException, InterruptedException
{
         out.close();
-        if (!hasData)
-          file.getFileSystem(conf).delete(file, false);
       }
     };
   }



Mime
View raw message