tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jh...@apache.org
Subject tajo git commit: TAJO-1258: Close() for classes derived from FileAppender should be robust. (Jongyoung Park via jinho)
Date Fri, 09 Jan 2015 02:01:13 GMT
Repository: tajo
Updated Branches:
  refs/heads/master 1c29c1cb4 -> 809cba375


TAJO-1258: Close() for classes derived from FileAppender should be robust. (Jongyoung Park
via jinho)

Closes #340


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/809cba37
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/809cba37
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/809cba37

Branch: refs/heads/master
Commit: 809cba3758564acd4def17928f95de7b4c913c45
Parents: 1c29c1c
Author: jhkim <jhkim@apache.org>
Authored: Fri Jan 9 11:00:27 2015 +0900
Committer: jhkim <jhkim@apache.org>
Committed: Fri Jan 9 11:00:27 2015 +0900

----------------------------------------------------------------------
 CHANGES                                                          | 3 +++
 .../src/main/java/org/apache/tajo/storage/CSVFile.java           | 4 +---
 .../src/main/java/org/apache/tajo/storage/RowFile.java           | 3 ++-
 .../src/main/java/org/apache/tajo/storage/avro/AvroAppender.java | 3 ++-
 .../java/org/apache/tajo/storage/parquet/ParquetAppender.java    | 3 ++-
 .../apache/tajo/storage/sequencefile/SequenceFileAppender.java   | 4 +---
 .../java/org/apache/tajo/storage/text/DelimitedTextFile.java     | 4 +---
 7 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/809cba37/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 96b63ea..369dbda 100644
--- a/CHANGES
+++ b/CHANGES
@@ -27,6 +27,9 @@ Release 0.9.1 - unreleased
 
   IMPROVEMENT
 
+    TAJO-1258: Close() for classes derived from FileAppender should be robust.
+    (Jongyoung Park via jinho)
+
     TAJO-1288: Refactoring org.apache.tajo.master package. (hyunsik)
 
     TAJO-1279: Cleanup TajoAsyncDispatcher and interrupt stop events. 

http://git-wip-us.apache.org/repos/asf/tajo/blob/809cba37/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/CSVFile.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/CSVFile.java
b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/CSVFile.java
index 28c263c..d4dde28 100644
--- a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/CSVFile.java
+++ b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/CSVFile.java
@@ -225,10 +225,8 @@ public class CSVFile {
           deflateFilter.resetState();
           deflateFilter = null;
         }
-
-        os.close();
       } finally {
-        IOUtils.cleanup(LOG, fos);
+        IOUtils.cleanup(LOG, os, fos, outputStream);
         if (compressor != null) {
           CodecPool.returnCompressor(compressor);
           compressor = null;

http://git-wip-us.apache.org/repos/asf/tajo/blob/809cba37/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/RowFile.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/RowFile.java
b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/RowFile.java
index 5510cbf..1ff6c4f 100644
--- a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/RowFile.java
+++ b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/RowFile.java
@@ -25,6 +25,7 @@ import org.apache.hadoop.fs.FSDataInputStream;
 import org.apache.hadoop.fs.FSDataOutputStream;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.io.IOUtils;
 import org.apache.tajo.TaskAttemptId;
 import org.apache.tajo.catalog.Column;
 import org.apache.tajo.catalog.Schema;
@@ -468,7 +469,7 @@ public class RowFile {
         }
         sync();
         out.flush();
-        out.close();
+        IOUtils.cleanup(LOG, out);
       }
     }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/809cba37/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/avro/AvroAppender.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/avro/AvroAppender.java
b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/avro/AvroAppender.java
index f617099..da426ea 100644
--- a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/avro/AvroAppender.java
+++ b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/avro/AvroAppender.java
@@ -28,6 +28,7 @@ import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FSDataOutputStream;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.io.IOUtils;
 import org.apache.tajo.TaskAttemptId;
 import org.apache.tajo.catalog.Column;
 import org.apache.tajo.catalog.TableMeta;
@@ -201,7 +202,7 @@ public class AvroAppender extends FileAppender {
    */
   @Override
   public void close() throws IOException {
-    dataFileWriter.close();
+    IOUtils.cleanup(null, dataFileWriter);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/tajo/blob/809cba37/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/parquet/ParquetAppender.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/parquet/ParquetAppender.java
b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/parquet/ParquetAppender.java
index 4557287..415c338 100644
--- a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/parquet/ParquetAppender.java
+++ b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/parquet/ParquetAppender.java
@@ -18,6 +18,7 @@
 
 package org.apache.tajo.storage.parquet;
 
+import org.apache.hadoop.io.IOUtils;
 import org.apache.tajo.TaskAttemptId;
 import org.apache.tajo.storage.StorageConstants;
 import parquet.hadoop.ParquetOutputFormat;
@@ -128,7 +129,7 @@ public class ParquetAppender extends FileAppender {
    */
   @Override
   public void close() throws IOException {
-    writer.close();
+    IOUtils.cleanup(null, writer);
   }
 
   public long getEstimatedOutputSize() throws IOException {

http://git-wip-us.apache.org/repos/asf/tajo/blob/809cba37/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/sequencefile/SequenceFileAppender.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/sequencefile/SequenceFileAppender.java
b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/sequencefile/SequenceFileAppender.java
index 8b5d677..404352c 100644
--- a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/sequencefile/SequenceFileAppender.java
+++ b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/sequencefile/SequenceFileAppender.java
@@ -248,7 +248,6 @@ public class SequenceFileAppender extends FileAppender {
   @Override
   public void flush() throws IOException {
     os.flush();
-    writer.close();
   }
 
   @Override
@@ -258,8 +257,7 @@ public class SequenceFileAppender extends FileAppender {
       stats.setNumBytes(getOffset());
     }
 
-    os.close();
-    writer.close();
+    IOUtils.cleanup(LOG, os, writer);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/tajo/blob/809cba37/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/text/DelimitedTextFile.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/text/DelimitedTextFile.java
b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/text/DelimitedTextFile.java
index 15db4c3..ac7c549 100644
--- a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/text/DelimitedTextFile.java
+++ b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/text/DelimitedTextFile.java
@@ -241,10 +241,8 @@ public class DelimitedTextFile {
           deflateFilter.resetState();
           deflateFilter = null;
         }
-
-        os.close();
       } finally {
-        IOUtils.cleanup(LOG, fos);
+        IOUtils.cleanup(LOG, fos, os, outputStream);
         if (compressor != null) {
           CodecPool.returnCompressor(compressor);
           compressor = null;


Mime
View raw message