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

This commit is contained in:
Zhe Zhang 2015-05-12 14:31:28 -07:00 committed by Zhe Zhang
parent 97a2396af6
commit 54d2827522
2 changed files with 10 additions and 5 deletions

View File

@ -201,3 +201,6 @@
HDFS-8372. Erasure coding: compute storage type quotas for striped files, HDFS-8372. Erasure coding: compute storage type quotas for striped files,
to be consistent with HDFS-8327. (Zhe Zhang via jing9) 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)

View File

@ -1193,12 +1193,14 @@ public DFSInputStream open(String src, int buffersize, boolean verifyChecksum)
// Get block info from namenode // Get block info from namenode
TraceScope scope = getPathTraceScope("newDFSInputStream", src); TraceScope scope = getPathTraceScope("newDFSInputStream", src);
try { try {
ECSchema schema = getFileInfo(src).getECSchema(); HdfsFileStatus fileInfo = getFileInfo(src);
if (schema != null) { if (fileInfo != null) {
return new DFSStripedInputStream(this, src, verifyChecksum, schema); ECSchema schema = fileInfo.getECSchema();
} else { if (schema != null) {
return new DFSInputStream(this, src, verifyChecksum); return new DFSStripedInputStream(this, src, verifyChecksum, schema);
}
} }
return new DFSInputStream(this, src, verifyChecksum);
} finally { } finally {
scope.close(); scope.close();
} }