diff --git a/src/client/InputStreamImpl.cpp b/src/client/InputStreamImpl.cpp index bbab122c..c549cce6 100644 --- a/src/client/InputStreamImpl.cpp +++ b/src/client/InputStreamImpl.cpp @@ -423,6 +423,15 @@ void InputStreamImpl::setupBlockReader(bool temporaryDisableLocalRead) { } break; + } catch (const HdfsTimeoutException & e) { + lastException = current_exception(); + std::string buffer; + LOG(LOG_ERROR, + "cannot setup block reader for Block: %s file %s on Datanode: %s.\n%s\nretry another node", + curBlock->toString().c_str(), path.c_str(), + curNode.formatAddress().c_str(), GetExceptionDetail(e, buffer)); + failedNodes.push_back(curNode); + failedNodes.sort(); } catch (const HdfsIOException & e) { lastException = current_exception(); std::string buffer; @@ -515,6 +524,15 @@ void InputStreamImpl::setupBlockReader(bool temporaryDisableLocalRead, shared_pt } break; + } catch (const HdfsTimeoutException & e) { + lastException = current_exception(); + std::string buffer; + LOG(LOG_ERROR, + "cannot setup block reader for Block: %s file %s on Datanode: %s.\n%s\nretry another node", + curBlock->toString().c_str(), path.c_str(), + curNode.formatAddress().c_str(), GetExceptionDetail(e, buffer)); + failedNodes.push_back(curNode); + failedNodes.sort(); } catch (const HdfsIOException & e) { lastException = current_exception(); std::string buffer; diff --git a/src/client/RemoteBlockReader.cpp b/src/client/RemoteBlockReader.cpp index 9e7759cb..e43a6985 100644 --- a/src/client/RemoteBlockReader.cpp +++ b/src/client/RemoteBlockReader.cpp @@ -217,6 +217,9 @@ shared_ptr RemoteBlockReader::readPacketHeader() { retval = shared_ptr(new PacketHeader); retval->readFields(buf.data(), packetHeaderLen); return retval; + } catch (const HdfsTimeoutException & e) { + NESTED_THROW(HdfsIOException, "RemoteBlockReader: failed to read block header for Block: %s from Datanode: %s.", + binfo.toString().c_str(), datanode.formatAddress().c_str()); } catch (const HdfsIOException & e) { NESTED_THROW(HdfsIOException, "RemoteBlockReader: failed to read block header for Block: %s from Datanode: %s.", binfo.toString().c_str(), datanode.formatAddress().c_str()); diff --git a/src/client/StripedInputStreamImpl.cpp b/src/client/StripedInputStreamImpl.cpp index 7efad306..1d5d9524 100644 --- a/src/client/StripedInputStreamImpl.cpp +++ b/src/client/StripedInputStreamImpl.cpp @@ -215,6 +215,17 @@ bool StripedInputStreamImpl::createBlockReader(LocatedBlock & block, block.getToken(), clientName, verify, *conf)); } + } catch (const HdfsTimeoutException & e) { + lastException = current_exception(); + std::string buffer; + LOG(LOG_ERROR, + "cannot setup block reader for Block: %s file %s on Datanode: %s.\n%s\nretry another node", + block.toString().c_str(), path.c_str(), + node->formatAddress().c_str(), GetExceptionDetail(e, buffer)); + failedNodes.push_back(*node); + failedNodes.sort(); + + continue; } catch (const HdfsIOException & e) { lastException = current_exception(); std::string buffer;