HDFS-8368. Erasure Coding: DFS opening a non-existent file need to be handled 
properly. Contributed by Rakesh R.


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

Branch: refs/heads/HDFS-7285
Commit: 54d28275226e0bc3b0d46142ce20f74a52e66395
Parents: 97a2396
Author: Zhe Zhang <[email protected]>
Authored: Tue May 12 14:31:28 2015 -0700
Committer: Zhe Zhang <[email protected]>
Committed: Tue May 26 12:01:50 2015 -0700

----------------------------------------------------------------------
 .../hadoop-hdfs/CHANGES-HDFS-EC-7285.txt                |  3 +++
 .../src/main/java/org/apache/hadoop/hdfs/DFSClient.java | 12 +++++++-----
 2 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/54d28275/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt 
b/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt
index f026a5c..79ad208 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt
@@ -201,3 +201,6 @@
 
     HDFS-8372. Erasure coding: compute storage type quotas for striped files,
     to be consistent with HDFS-8327. (Zhe Zhang via jing9)
+
+    HDFS-8368. Erasure Coding: DFS opening a non-existent file need to be 
+    handled properly (Rakesh R via zhz)

http://git-wip-us.apache.org/repos/asf/hadoop/blob/54d28275/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java
 
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java
index 9155b4d..ffeb568 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java
@@ -1193,12 +1193,14 @@ public class DFSClient implements java.io.Closeable, 
RemotePeerFactory,
     //    Get block info from namenode
     TraceScope scope = getPathTraceScope("newDFSInputStream", src);
     try {
-      ECSchema schema = getFileInfo(src).getECSchema();
-      if (schema != null) {
-        return new DFSStripedInputStream(this, src, verifyChecksum, schema);
-      } else {
-        return new DFSInputStream(this, src, verifyChecksum);
+      HdfsFileStatus fileInfo = getFileInfo(src);
+      if (fileInfo != null) {
+        ECSchema schema = fileInfo.getECSchema();
+        if (schema != null) {
+          return new DFSStripedInputStream(this, src, verifyChecksum, schema);
+        }
       }
+      return new DFSInputStream(this, src, verifyChecksum);
     } finally {
       scope.close();
     }

Reply via email to