private DataXceiver(Peer peer, DataNode datanode, DataXceiverServer dataXceiverServer) throws IOException { super(datanode.getTracer()); this.peer = peer; this.dnConf = datanode.getDnConf(); this.socketIn = peer.getInputStream(); this.socketOut = peer.getOutputStream(); this.datanode = datanode; this.dataXceiverServer = dataXceiverServer; this.connectToDnViaHostname = datanode.getDnConf().connectToDnViaHostname; this.ioFileBufferSize = DFSUtilClient.getIoFileBufferSize(datanode.getConf()); this.smallBufferSize = DFSUtilClient.getSmallBufferSize(datanode.getConf()); remoteAddress = peer.getRemoteAddressString(); final int colonIdx = remoteAddress.indexOf(':'); remoteAddressWithoutPort = (colonIdx < 0) ? remoteAddress : remoteAddress.substring(0, colonIdx); localAddress = peer.getLocalAddressString(); LOG.debug("Number of active connections is: {}", datanode.getXceiverCount()); }
cipherSuites, peer.getRemoteAddressString()); peer.getRemoteAddressString());
"at {}. Perhaps the client " + "is running an older version of Hadoop which does not support " + "encryption", peer.getRemoteAddressString(), imne); } else { LOG.info("Failed to read expected SASL data transfer protection " + ". Perhaps the client is running an older version of Hadoop " + "which does not support SASL data transfer protection", peer.getRemoteAddressString(), imne);
"to " + peer.getRemoteAddressString() + " because it's pinned "; LOG.info(msg); sendResponse(Status.ERROR_BLOCK_PINNED, msg); "to " + peer.getRemoteAddressString() + " because threads " + "quota is exceeded."; LOG.info(msg); datanode.metrics.incrTotalReadTime(duration); LOG.info("Copied {} to {}", block, peer.getRemoteAddressString()); } catch (IOException ioe) { isOpSuccess = false;
" from " + peer.getRemoteAddressString() + " because threads " + "quota is exceeded."; LOG.warn(msg); block, peer.getRemoteAddressString(), delHint); } catch (IOException ioe) { LOG.warn("Error writing reply back to {}", peer.getRemoteAddressString()); incrDatanodeNetworkErrors();
@Override public String getRemoteAddressString() { return enclosedPeer.getRemoteAddressString(); }
@Override public String getRemoteAddressString() { return enclosedPeer.getRemoteAddressString(); }
@Override public String getRemoteAddressString() { return enclosedPeer.getRemoteAddressString(); }
LOG.warn("Client {} did not send a valid status code " + "after reading. Will close connection.", peer.getRemoteAddressString()); IOUtils.closeStream(out);
peer.getRemoteAddressString(), peer.getLocalAddressString(), stage, latestGenerationStamp, minBytesRcvd, maxBytesRcvd,
/** * Returns InetAddress from peer. The getRemoteAddressString has the form * [host][/ip-address]:port. The host may be missing. The IP address (and * preceding '/') may be missing. The port preceded by ':' is always present. * * @return InetAddress from peer */ public static InetAddress getPeerAddress(Peer peer) { String remoteAddr = peer.getRemoteAddressString().split(":")[0]; int slashIdx = remoteAddr.indexOf('/'); return InetAddresses.forString(slashIdx != -1 ? remoteAddr.substring(slashIdx + 1, remoteAddr.length()) : remoteAddr); }
/** * Returns InetAddress from peer. The getRemoteAddressString has the form * [host][/ip-address]:port. The host may be missing. The IP address (and * preceding '/') may be missing. The port preceded by ':' is always present. * * @param peer * @return InetAddress from peer */ public static InetAddress getPeerAddress(Peer peer) { String remoteAddr = peer.getRemoteAddressString().split(":")[0]; int slashIdx = remoteAddr.indexOf('/'); return InetAddresses.forString(slashIdx != -1 ? remoteAddr.substring(slashIdx + 1, remoteAddr.length()) : remoteAddr); }
/** * Returns InetAddress from peer. The getRemoteAddressString has the form * [host][/ip-address]:port. The host may be missing. The IP address (and * preceding '/') may be missing. The port preceded by ':' is always present. * * @param peer * @return InetAddress from peer */ public static InetAddress getPeerAddress(Peer peer) { String remoteAddr = peer.getRemoteAddressString().split(":")[0]; int slashIdx = remoteAddr.indexOf('/'); return InetAddresses.forString(slashIdx != -1 ? remoteAddr.substring(slashIdx + 1, remoteAddr.length()) : remoteAddr); }
/** * When the reader reaches end of the read, it sends a status response * (e.g. CHECKSUM_OK) to the DN. Failure to do so could lead to the DN * closing our connection (which we will re-open), but won't affect * data correctness. */ void sendReadResult(Peer peer, Status statusCode) { assert !sentStatusCode : "already sent status code to " + peer; try { RemoteBlockReader2.writeReadResult(peer.getOutputStream(), statusCode); sentStatusCode = true; } catch (IOException e) { // It's ok not to be able to send this. But something is probably wrong. LOG.info("Could not send read status (" + statusCode + ") to datanode " + peer.getRemoteAddressString() + ": " + e.getMessage()); } }
/** * When the reader reaches end of the read, it sends a status response * (e.g. CHECKSUM_OK) to the DN. Failure to do so could lead to the DN * closing our connection (which we will re-open), but won't affect * data correctness. */ void sendReadResult(Status statusCode) { assert !sentStatusCode : "already sent status code to " + peer; try { writeReadResult(peer.getOutputStream(), statusCode); sentStatusCode = true; } catch (IOException e) { // It's ok not to be able to send this. But something is probably wrong. LOG.info("Could not send read status (" + statusCode + ") to datanode " + peer.getRemoteAddressString() + ": " + e.getMessage()); } }
/** * When the reader reaches end of the read, it sends a status response * (e.g. CHECKSUM_OK) to the DN. Failure to do so could lead to the DN * closing our connection (which we will re-open), but won't affect * data correctness. */ void sendReadResult(Peer peer, Status statusCode) { assert !sentStatusCode : "already sent status code to " + peer; try { RemoteBlockReader2.writeReadResult(peer.getOutputStream(), statusCode); sentStatusCode = true; } catch (IOException e) { // It's ok not to be able to send this. But something is probably wrong. LOG.info("Could not send read status (" + statusCode + ") to datanode " + peer.getRemoteAddressString() + ": " + e.getMessage()); } }
/** * When the reader reaches end of the read, it sends a status response * (e.g. CHECKSUM_OK) to the DN. Failure to do so could lead to the DN * closing our connection (which we will re-open), but won't affect * data correctness. */ void sendReadResult(Status statusCode) { assert !sentStatusCode : "already sent status code to " + peer; try { writeReadResult(peer.getOutputStream(), statusCode); sentStatusCode = true; } catch (IOException e) { // It's ok not to be able to send this. But something is probably wrong. LOG.info("Could not send read status (" + statusCode + ") to datanode " + peer.getRemoteAddressString() + ": " + e.getMessage()); } }
static void checkSuccess( BlockOpResponseProto status, Peer peer, ExtendedBlock block, String file) throws IOException { String logInfo = "for OP_READ_BLOCK" + ", self=" + peer.getLocalAddressString() + ", remote=" + peer.getRemoteAddressString() + ", for file " + file + ", for pool " + block.getBlockPoolId() + " block " + block.getBlockId() + "_" + block.getGenerationStamp(); DataTransferProtoUtil.checkBlockOpStatus(status, logInfo); }
static void checkSuccess( BlockOpResponseProto status, Peer peer, ExtendedBlock block, String file) throws IOException { String logInfo = "for OP_READ_BLOCK" + ", self=" + peer.getLocalAddressString() + ", remote=" + peer.getRemoteAddressString() + ", for file " + file + ", for pool " + block.getBlockPoolId() + " block " + block.getBlockId() + "_" + block.getGenerationStamp(); DataTransferProtoUtil.checkBlockOpStatus(status, logInfo); }
static void checkSuccess( BlockOpResponseProto status, Peer peer, ExtendedBlock block, String file) throws IOException { String logInfo = "for OP_READ_BLOCK" + ", self=" + peer.getLocalAddressString() + ", remote=" + peer.getRemoteAddressString() + ", for file " + file + ", for pool " + block.getBlockPoolId() + " block " + block.getBlockId() + "_" + block.getGenerationStamp(); DataTransferProtoUtil.checkBlockOpStatus(status, logInfo); }