HDFS-17337. RPC RESPONSE time seems not exactly accurate when using FSEditLogAsync. (#6439). Contributed by farmmamba.
Reviewed-by: Tao Li <tomscut@apache.org> Signed-off-by: Shuyan Zhang <zhangshuyan@apache.org>
This commit is contained in:
parent
eeb657e85f
commit
ba6ada73ac
@ -1089,7 +1089,10 @@ public final void sendResponse() throws IOException {
|
|||||||
int count = responseWaitCount.decrementAndGet();
|
int count = responseWaitCount.decrementAndGet();
|
||||||
assert count >= 0 : "response has already been sent";
|
assert count >= 0 : "response has already been sent";
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
|
long startNanos = Time.monotonicNowNanos();
|
||||||
doResponse(null);
|
doResponse(null);
|
||||||
|
getProcessingDetails().set(Timing.RESPONSE,
|
||||||
|
Time.monotonicNowNanos() - startNanos, TimeUnit.NANOSECONDS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1257,14 +1260,10 @@ public Void run() throws Exception {
|
|||||||
deltaNanos -= details.get(Timing.LOCKSHARED, TimeUnit.NANOSECONDS);
|
deltaNanos -= details.get(Timing.LOCKSHARED, TimeUnit.NANOSECONDS);
|
||||||
deltaNanos -= details.get(Timing.LOCKEXCLUSIVE, TimeUnit.NANOSECONDS);
|
deltaNanos -= details.get(Timing.LOCKEXCLUSIVE, TimeUnit.NANOSECONDS);
|
||||||
details.set(Timing.LOCKFREE, deltaNanos, TimeUnit.NANOSECONDS);
|
details.set(Timing.LOCKFREE, deltaNanos, TimeUnit.NANOSECONDS);
|
||||||
startNanos = Time.monotonicNowNanos();
|
|
||||||
|
|
||||||
setResponseFields(value, responseParams);
|
setResponseFields(value, responseParams);
|
||||||
sendResponse();
|
sendResponse();
|
||||||
|
|
||||||
details.setReturnStatus(responseParams.returnStatus);
|
details.setReturnStatus(responseParams.returnStatus);
|
||||||
deltaNanos = Time.monotonicNowNanos() - startNanos;
|
|
||||||
details.set(Timing.RESPONSE, deltaNanos, TimeUnit.NANOSECONDS);
|
|
||||||
} else {
|
} else {
|
||||||
LOG.debug("Deferring response for callId: {}", this.callId);
|
LOG.debug("Deferring response for callId: {}", this.callId);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user