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/3c743b47 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/3c743b47 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/3c743b47 Branch: refs/heads/HDFS-7240 Commit: 3c743b475e6ec431a5849ebd467b077e41e89987 Parents: c5e7a69 Author: James Clampffer <james.clampf...@hp.com> Authored: Fri Jul 7 14:04:42 2017 -0400 Committer: James Clampffer <james.clampf...@hp.com> Committed: Thu Mar 22 17:19:47 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/3c743b47/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: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org