kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject kudu git commit: KUDU-2374: Add RpcContext::GetTimeReceived()
Date Mon, 26 Mar 2018 16:35:53 GMT
Repository: kudu
Updated Branches:
  refs/heads/master f2d2a3288 -> 56a86481f


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 <todd@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/56a86481
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/56a86481
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/56a86481

Branch: refs/heads/master
Commit: 56a86481fde6c18b4cc1f0d802534f50947b2329
Parents: f2d2a32
Author: Michael Ho <kwho@cloudera.com>
Authored: Sat Mar 24 17:49:58 2018 -0700
Committer: Todd Lipcon <todd@apache.org>
Committed: Mon Mar 26 16:33:48 2018 +0000

----------------------------------------------------------------------
 src/kudu/rpc/rpc-test-base.h | 3 +++
 src/kudu/rpc/rpc_context.cc  | 4 ++++
 src/kudu/rpc/rpc_context.h   | 3 +++
 3 files changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/56a86481/src/kudu/rpc/rpc-test-base.h
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/rpc-test-base.h b/src/kudu/rpc/rpc-test-base.h
index 3c1f571..2fb742e 100644
--- a/src/kudu/rpc/rpc-test-base.h
+++ b/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"
@@ -211,6 +212,8 @@ class GenericCalculatorService : public ServiceIf {
 
     LOG(INFO) << "got call: " << pb_util::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/kudu/blob/56a86481/src/kudu/rpc/rpc_context.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/rpc_context.cc b/src/kudu/rpc/rpc_context.cc
index 123d21f..a375c62 100644
--- a/src/kudu/rpc/rpc_context.cc
+++ b/src/kudu/rpc/rpc_context.cc
@@ -185,6 +185,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/kudu/blob/56a86481/src/kudu/rpc/rpc_context.h
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/rpc_context.h b/src/kudu/rpc/rpc_context.h
index a34c1a1..c8462ab 100644
--- a/src/kudu/rpc/rpc_context.h
+++ b/src/kudu/rpc/rpc_context.h
@@ -204,6 +204,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; }


Mime
View raw message