HDFS-12013: libhdfs++: read with offset at EOF should return 0 bytes instead of error. Contributed by Xiaowei Zhu
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/ba8ca0bd Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/ba8ca0bd Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/ba8ca0bd Branch: refs/heads/HDFS-8707 Commit: ba8ca0bd096532ef3ab6e13fbe23ccaa61d7376e Parents: 5827aec Author: James Clampffer <[email protected]> Authored: Fri Jul 7 14:04:42 2017 -0400 Committer: James Clampffer <[email protected]> Committed: Thu Mar 22 16:20:45 2018 -0400 ---------------------------------------------------------------------- .../src/main/native/libhdfspp/lib/fs/filehandle.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/ba8ca0bd/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/filehandle.cc ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/filehandle.cc b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/filehandle.cc index eea7ac9..2087d53 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/filehandle.cc +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/filehandle.cc @@ -181,7 +181,10 @@ void FileHandleImpl::AsyncPreadSome( return; } - if(offset >= file_info_->file_length_){ + if(offset == file_info_->file_length_) { + handler(Status::OK(), "", 0); + return; + } else if(offset > file_info_->file_length_){ handler(Status::InvalidOffset("AsyncPreadSome: trying to begin a read past the EOF"), "", 0); return; } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
