Pārlūkot izejas kodu

libhdfs++: File length doesn't always count the last block if it's being written to. Contributed by Xiaowei Zhu.

James 9 gadi atpakaļ
vecāks
revīzija
3b6d57d5c0

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

@@ -104,6 +104,7 @@ void NameNodeOperations::GetBlockLocations(const std::string & path,
 
       if (locations.has_lastblock() && locations.lastblock().b().numbytes()) {
         file_info->blocks_.push_back(locations.lastblock());
+        file_info->file_length_ += locations.lastblock().b().numbytes();
       }
 
       handler(stat, file_info);