hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From szets...@apache.org
Subject hadoop git commit: HDFS-7681. Change ReplicaInputStreams constructor to take InputStream(s) instead of FileDescriptor(s). Contributed by Joe Pallas
Date Mon, 02 Feb 2015 21:30:29 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 2ecfd018f -> a5568a276


HDFS-7681. Change ReplicaInputStreams constructor to take InputStream(s) instead of FileDescriptor(s).
 Contributed by Joe Pallas

Conflicts:
	hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt


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

Branch: refs/heads/branch-2
Commit: a5568a276d7f369e3ca399f51ec88c4552a8bacc
Parents: 2ecfd01
Author: Tsz-Wo Nicholas Sze <szetszwo@hortonworks.com>
Authored: Wed Jan 28 15:59:33 2015 -0800
Committer: Tsz-Wo Nicholas Sze <szetszwo@hortonworks.com>
Committed: Mon Feb 2 13:30:07 2015 -0800

----------------------------------------------------------------------
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt               |  3 +++
 .../server/datanode/fsdataset/ReplicaInputStreams.java    |  6 +++---
 .../server/datanode/fsdataset/impl/FsDatasetImpl.java     | 10 ++++++++--
 3 files changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/a5568a27/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index eaf3a23..b6290ad 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -288,6 +288,9 @@ Release 2.7.0 - UNRELEASED
     type instead of concrete classes Block and ReplicaInfo.  (David Powell
     and Joe Pallas via szetszwo)
 
+    HDFS-7681. Change ReplicaInputStreams constructor to take InputStream(s)
+    instead of FileDescriptor(s).  (Joe Pallas via szetszwo)
+
   OPTIMIZATIONS
 
     HDFS-7454. Reduce memory footprint for AclEntries in NameNode.

http://git-wip-us.apache.org/repos/asf/hadoop/blob/a5568a27/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/ReplicaInputStreams.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/ReplicaInputStreams.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/ReplicaInputStreams.java
index a8bf622..e0928a4 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/ReplicaInputStreams.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/ReplicaInputStreams.java
@@ -33,11 +33,11 @@ public class ReplicaInputStreams implements Closeable {
   private final FsVolumeReference volumeRef;
 
   /** Create an object with a data input stream and a checksum input stream. */
-  public ReplicaInputStreams(FileDescriptor dataFd, FileDescriptor checksumFd,
+  public ReplicaInputStreams(InputStream dataStream, InputStream checksumStream,
       FsVolumeReference volumeRef) {
     this.volumeRef = volumeRef;
-    this.dataIn = new FileInputStream(dataFd);
-    this.checksumIn = new FileInputStream(checksumFd);
+    this.dataIn = dataStream;
+    this.checksumIn = checksumStream;
   }
 
   /** @return the data input stream. */

http://git-wip-us.apache.org/repos/asf/hadoop/blob/a5568a27/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java
index ff10e1e..24b4601 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java
@@ -644,8 +644,14 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
       if (ckoff > 0) {
         metaInFile.seek(ckoff);
       }
-      return new ReplicaInputStreams(
-          blockInFile.getFD(), metaInFile.getFD(), ref);
+      InputStream blockInStream = new FileInputStream(blockInFile.getFD());
+      try {
+        InputStream metaInStream = new FileInputStream(metaInFile.getFD());
+        return new ReplicaInputStreams(blockInStream, metaInStream, ref);
+      } catch (IOException e) {
+        IOUtils.cleanup(null, blockInStream);
+        throw e;
+      }
     } catch (IOException e) {
       IOUtils.cleanup(null, ref);
       throw e;


Mime
View raw message