HDFS-3375. Put client name in DataXceiver thread name for readBlock and keepalive. Contributed by Todd Lipcon.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1335270 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
07280c9761
commit
7aa2889f82
@ -428,6 +428,9 @@ Release 2.0.0 - UNRELEASED
|
|||||||
HDFS-3365. Enable users to disable socket caching in DFS client
|
HDFS-3365. Enable users to disable socket caching in DFS client
|
||||||
configuration (todd)
|
configuration (todd)
|
||||||
|
|
||||||
|
HDFS-3375. Put client name in DataXceiver thread name for readBlock
|
||||||
|
and keepalive (todd)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
HDFS-3024. Improve performance of stringification in addStoredBlock (todd)
|
HDFS-3024. Improve performance of stringification in addStoredBlock (todd)
|
||||||
|
@ -86,6 +86,12 @@ class DataXceiver extends Receiver implements Runnable {
|
|||||||
private long opStartTime; //the start time of receiving an Op
|
private long opStartTime; //the start time of receiving an Op
|
||||||
private final SocketInputWrapper socketInputWrapper;
|
private final SocketInputWrapper socketInputWrapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Client Name used in previous operation. Not available on first request
|
||||||
|
* on the socket.
|
||||||
|
*/
|
||||||
|
private String previousOpClientName;
|
||||||
|
|
||||||
public static DataXceiver create(Socket s, DataNode dn,
|
public static DataXceiver create(Socket s, DataNode dn,
|
||||||
DataXceiverServer dataXceiverServer) throws IOException {
|
DataXceiverServer dataXceiverServer) throws IOException {
|
||||||
|
|
||||||
@ -122,7 +128,11 @@ private DataXceiver(Socket s,
|
|||||||
*/
|
*/
|
||||||
private void updateCurrentThreadName(String status) {
|
private void updateCurrentThreadName(String status) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("DataXceiver for client ").append(remoteAddress);
|
sb.append("DataXceiver for client ");
|
||||||
|
if (previousOpClientName != null) {
|
||||||
|
sb.append(previousOpClientName).append(" at ");
|
||||||
|
}
|
||||||
|
sb.append(remoteAddress);
|
||||||
if (status != null) {
|
if (status != null) {
|
||||||
sb.append(" [").append(status).append("]");
|
sb.append(" [").append(status).append("]");
|
||||||
}
|
}
|
||||||
@ -202,6 +212,8 @@ public void readBlock(final ExtendedBlock block,
|
|||||||
final String clientName,
|
final String clientName,
|
||||||
final long blockOffset,
|
final long blockOffset,
|
||||||
final long length) throws IOException {
|
final long length) throws IOException {
|
||||||
|
previousOpClientName = clientName;
|
||||||
|
|
||||||
OutputStream baseStream = NetUtils.getOutputStream(s,
|
OutputStream baseStream = NetUtils.getOutputStream(s,
|
||||||
dnConf.socketWriteTimeout);
|
dnConf.socketWriteTimeout);
|
||||||
DataOutputStream out = new DataOutputStream(new BufferedOutputStream(
|
DataOutputStream out = new DataOutputStream(new BufferedOutputStream(
|
||||||
@ -295,7 +307,8 @@ public void writeBlock(final ExtendedBlock block,
|
|||||||
final long maxBytesRcvd,
|
final long maxBytesRcvd,
|
||||||
final long latestGenerationStamp,
|
final long latestGenerationStamp,
|
||||||
DataChecksum requestedChecksum) throws IOException {
|
DataChecksum requestedChecksum) throws IOException {
|
||||||
updateCurrentThreadName("Receiving block " + block + " client=" + clientname);
|
previousOpClientName = clientname;
|
||||||
|
updateCurrentThreadName("Receiving block " + block);
|
||||||
final boolean isDatanode = clientname.length() == 0;
|
final boolean isDatanode = clientname.length() == 0;
|
||||||
final boolean isClient = !isDatanode;
|
final boolean isClient = !isDatanode;
|
||||||
final boolean isTransfer = stage == BlockConstructionStage.TRANSFER_RBW
|
final boolean isTransfer = stage == BlockConstructionStage.TRANSFER_RBW
|
||||||
@ -502,7 +515,7 @@ public void transferBlock(final ExtendedBlock blk,
|
|||||||
final DatanodeInfo[] targets) throws IOException {
|
final DatanodeInfo[] targets) throws IOException {
|
||||||
checkAccess(null, true, blk, blockToken,
|
checkAccess(null, true, blk, blockToken,
|
||||||
Op.TRANSFER_BLOCK, BlockTokenSecretManager.AccessMode.COPY);
|
Op.TRANSFER_BLOCK, BlockTokenSecretManager.AccessMode.COPY);
|
||||||
|
previousOpClientName = clientName;
|
||||||
updateCurrentThreadName(Op.TRANSFER_BLOCK + " " + blk);
|
updateCurrentThreadName(Op.TRANSFER_BLOCK + " " + blk);
|
||||||
|
|
||||||
final DataOutputStream out = new DataOutputStream(
|
final DataOutputStream out = new DataOutputStream(
|
||||||
|
Loading…
Reference in New Issue
Block a user