HDFS-11305: libhdfs++: Log Datanode information when reading an HDFS block. Contributed by Xiaowei Zhu.

This commit is contained in:
James 2017-01-10 11:25:56 -05:00 committed by James Clampffer
parent a30cf6a369
commit 69d55340f8

View File

@ -225,6 +225,12 @@ void FileHandleImpl::AsyncPreadSome(
DatanodeInfoProto &chosen_dn = *it; DatanodeInfoProto &chosen_dn = *it;
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 offset_within_block = offset - block->offset();
uint64_t size_within_block = std::min<uint64_t>( uint64_t size_within_block = std::min<uint64_t>(
block->b().numbytes() - offset_within_block, asio::buffer_size(buffers)); block->b().numbytes() - offset_within_block, asio::buffer_size(buffers));