From 0f3f8db113621e177dbb7fc3e93f4870bff2d739 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 24 Feb 2017 10:46:50 -0500 Subject: [PATCH] HDFS-11449: libhdfs++: Log Datanode read size when reading from an HDFS block. Contributed by Xiaowei Zhu. --- .../src/main/native/libhdfspp/lib/fs/filehandle.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 1f553a090f..24e81b69d3 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 @@ -227,14 +227,15 @@ void FileHandleImpl::AsyncPreadSome( std::string dnIpAddr = chosen_dn.id().ipaddr(); std::string dnHostName = chosen_dn.id().hostname(); - LOG_DEBUG(kFileHandle, << "FileHandleImpl::AsyncPreadSome(" - << FMT_THIS_ADDR << "), ...) Datanode hostname=" << dnHostName << ", IP Address=" << dnIpAddr - << ", file path=\"" << path_ << "\", offset=" << offset); uint64_t offset_within_block = offset - block->offset(); uint64_t size_within_block = std::min( block->b().numbytes() - offset_within_block, asio::buffer_size(buffers)); + LOG_DEBUG(kFileHandle, << "FileHandleImpl::AsyncPreadSome(" + << FMT_THIS_ADDR << "), ...) Datanode hostname=" << dnHostName << ", IP Address=" << dnIpAddr + << ", file path=\"" << path_ << "\", offset=" << offset << ", read size=" << size_within_block); + // This is where we will put the logic for re-using a DN connection; we can // steal the FileHandle's dn and put it back when we're done std::shared_ptr dn = CreateDataNodeConnection(io_service_, chosen_dn, &block->blocktoken());