Repository: impala Updated Branches: refs/heads/master 37565e381 -> fc1eb75da
KUDU-2374: Add RpcContext::GetTimeReceived() This change adds RpcContext::GetTimeReceived() which returns the time at which the inbound call associated with the RpcContext was received. It's helpful to make this accessible to the RPC handlers for its own book-keeping purpose (e.g. reporting the average dispatch latency as part of query profile in Impala). Change-Id: I6b39c7f2ea856eccfdab8c1bb1433829e979ae13 Reviewed-on: http://gerrit.cloudera.org:8080/9796 Tested-by: Kudu Jenkins Reviewed-by: Todd Lipcon <[email protected]> Reviewed-on: http://gerrit.cloudera.org:8080/9807 Reviewed-by: Joe McDonnell <[email protected]> Tested-by: Impala Public Jenkins Project: http://git-wip-us.apache.org/repos/asf/impala/repo Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/fc1eb75d Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/fc1eb75d Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/fc1eb75d Branch: refs/heads/master Commit: fc1eb75da0aadd82597ca63d089c1a218b94f9f9 Parents: 37565e3 Author: Michael Ho <[email protected]> Authored: Sat Mar 24 17:49:58 2018 -0700 Committer: Impala Public Jenkins <[email protected]> Committed: Tue Mar 27 02:22:24 2018 +0000 ---------------------------------------------------------------------- be/src/kudu/rpc/rpc-test-base.h | 3 +++ be/src/kudu/rpc/rpc_context.cc | 4 ++++ be/src/kudu/rpc/rpc_context.h | 3 +++ 3 files changed, 10 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/impala/blob/fc1eb75d/be/src/kudu/rpc/rpc-test-base.h ---------------------------------------------------------------------- diff --git a/be/src/kudu/rpc/rpc-test-base.h b/be/src/kudu/rpc/rpc-test-base.h index 332a7a1..5a5652e 100644 --- a/be/src/kudu/rpc/rpc-test-base.h +++ b/be/src/kudu/rpc/rpc-test-base.h @@ -41,6 +41,7 @@ #include "kudu/util/env.h" #include "kudu/util/faststring.h" #include "kudu/util/mem_tracker.h" +#include "kudu/util/monotime.h" #include "kudu/util/net/sockaddr.h" #include "kudu/util/path_util.h" #include "kudu/util/pb_util.h" @@ -210,6 +211,8 @@ class GenericCalculatorService : public ServiceIf { LOG(INFO) << "got call: " << SecureShortDebugString(req); SleepFor(MonoDelta::FromMicroseconds(req.sleep_micros())); + MonoDelta duration(MonoTime::Now().GetDeltaSince(incoming->GetTimeReceived())); + CHECK_GE(duration.ToMicroseconds(), req.sleep_micros()); SleepResponsePB resp; incoming->RespondSuccess(resp); } http://git-wip-us.apache.org/repos/asf/impala/blob/fc1eb75d/be/src/kudu/rpc/rpc_context.cc ---------------------------------------------------------------------- diff --git a/be/src/kudu/rpc/rpc_context.cc b/be/src/kudu/rpc/rpc_context.cc index 274966b..3f5d556 100644 --- a/be/src/kudu/rpc/rpc_context.cc +++ b/be/src/kudu/rpc/rpc_context.cc @@ -183,6 +183,10 @@ MonoTime RpcContext::GetClientDeadline() const { return call_->GetClientDeadline(); } +MonoTime RpcContext::GetTimeReceived() const { + return call_->GetTimeReceived(); +} + Trace* RpcContext::trace() { return call_->trace(); } http://git-wip-us.apache.org/repos/asf/impala/blob/fc1eb75d/be/src/kudu/rpc/rpc_context.h ---------------------------------------------------------------------- diff --git a/be/src/kudu/rpc/rpc_context.h b/be/src/kudu/rpc/rpc_context.h index 938576c..353bedd 100644 --- a/be/src/kudu/rpc/rpc_context.h +++ b/be/src/kudu/rpc/rpc_context.h @@ -192,6 +192,9 @@ class RpcContext { // If the client did not specify a deadline, returns MonoTime::Max(). MonoTime GetClientDeadline() const; + // Return the time when the inbound call was received. + MonoTime GetTimeReceived() const; + // Whether the results of this RPC are tracked with a ResultTracker. // If this returns true, both result_tracker() and request_id() should return non-null results. bool AreResultsTracked() const { return result_tracker_.get() != nullptr; }
