diff --git a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientGrpc.java b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientGrpc.java index 4adfa8521b07..ae90cdfc3059 100644 --- a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientGrpc.java +++ b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientGrpc.java @@ -354,7 +354,7 @@ private XceiverClientReply sendCommandWithRetry( responseProto = null; } catch (ExecutionException e) { LOG.debug("Failed to execute command {} on datanode {}", - request, dn.getUuid(), e); + request, dn, e); if (Status.fromThrowable(e.getCause()).getCode() == Status.UNAUTHENTICATED.getCode()) { throw new SCMSecurityException("Failed to authenticate with " @@ -433,7 +433,7 @@ public XceiverClientReply sendCommandAsync( UUID dnId = dn.getUuid(); if (LOG.isDebugEnabled()) { LOG.debug("Send command {} to datanode {}", - request.getCmdType(), dn.getNetworkFullPath()); + request.getCmdType(), dn.getIpAddress()); } final CompletableFuture replyFuture = new CompletableFuture<>(); @@ -452,8 +452,14 @@ public XceiverClientReply sendCommandAsync( public void onNext(ContainerCommandResponseProto value) { replyFuture.complete(value); metrics.decrPendingContainerOpsMetrics(request.getCmdType()); + long cost = System.nanoTime() - requestTime; metrics.addContainerOpsLatency(request.getCmdType(), - System.nanoTime() - requestTime); + cost); + if (LOG.isDebugEnabled()) { + LOG.debug("Executed command {} on datanode {}, cost = {}, " + + "cmdType = {}", request, dn, + cost, request.getCmdType()); + } semaphore.release(); } @@ -461,8 +467,14 @@ public void onNext(ContainerCommandResponseProto value) { public void onError(Throwable t) { replyFuture.completeExceptionally(t); metrics.decrPendingContainerOpsMetrics(request.getCmdType()); + long cost = System.nanoTime() - requestTime; metrics.addContainerOpsLatency(request.getCmdType(), System.nanoTime() - requestTime); + if (LOG.isDebugEnabled()) { + LOG.debug("Executed command {} on datanode {}, cost = {}, " + + "cmdType = {}", request, dn, + cost, request.getCmdType()); + } semaphore.release(); }