From 1cbfd6f962f6ca0731339da0dfa58b84b8209aff Mon Sep 17 00:00:00 2001 From: James Date: Mon, 18 Apr 2016 09:25:53 -0400 Subject: [PATCH] libhdfs++: File length doesn't always count the last block if it's being written to. Contributed by Xiaowei Zhu. --- .../src/main/native/libhdfspp/lib/fs/filesystem.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/filesystem.cc b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/filesystem.cc index 569b479458..8530ffa626 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/filesystem.cc +++ b/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);