Przeglądaj źródła

HDFS-12013: libhdfs++: read with offset at EOF should return 0 bytes instead of error. Contributed by Xiaowei Zhu

James Clampffer 7 lat temu
rodzic
commit
0474cd0e9a

+ 4 - 1
hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/filehandle.cc

@@ -181,7 +181,10 @@ void FileHandleImpl::AsyncPreadSome(
     return;
     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);
     handler(Status::InvalidOffset("AsyncPreadSome: trying to begin a read past the EOF"), "", 0);
     return;
     return;
   }
   }