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:
hfutatzhanghb 2024-01-18 11:10:05 +08:00 committed by GitHub
parent eeb657e85f
commit ba6ada73ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1089,7 +1089,10 @@ public final void sendResponse() throws IOException {
int count = responseWaitCount.decrementAndGet();
assert count >= 0 : "response has already been sent";
if (count == 0) {
long startNanos = Time.monotonicNowNanos();
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.LOCKEXCLUSIVE, TimeUnit.NANOSECONDS);
details.set(Timing.LOCKFREE, deltaNanos, TimeUnit.NANOSECONDS);
startNanos = Time.monotonicNowNanos();
setResponseFields(value, responseParams);
sendResponse();
details.setReturnStatus(responseParams.returnStatus);
deltaNanos = Time.monotonicNowNanos() - startNanos;
details.set(Timing.RESPONSE, deltaNanos, TimeUnit.NANOSECONDS);
} else {
LOG.debug("Deferring response for callId: {}", this.callId);
}