You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by ad...@apache.org on 2017/03/17 00:28:54 UTC

kudu git commit: Add InboundCall::GetTransferSize()

Repository: kudu
Updated Branches:
  refs/heads/master 16dd6e4aa -> a1bfd7bac


Add InboundCall::GetTransferSize()

Returns what you might expect: the size of the transfer, or 0 if it's
been discarded. This has been useful for adding instrumentation to RPC
calls in their service pool.

Change-Id: I9d17963dc3ab271f560309d4aa5b4f9939cba403
Reviewed-on: http://gerrit.cloudera.org:8080/6374
Reviewed-by: Adar Dembo <ad...@cloudera.com>
Tested-by: Kudu Jenkins


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

Branch: refs/heads/master
Commit: a1bfd7bac1b83f1a37611b7f571e8c637f9ee9ec
Parents: 16dd6e4
Author: Henry Robinson <he...@cloudera.com>
Authored: Thu Mar 9 19:53:43 2017 -0800
Committer: Adar Dembo <ad...@cloudera.com>
Committed: Fri Mar 17 00:28:26 2017 +0000

----------------------------------------------------------------------
 src/kudu/rpc/inbound_call.cc | 5 +++++
 src/kudu/rpc/inbound_call.h  | 4 ++++
 src/kudu/rpc/rpc-test-base.h | 2 ++
 3 files changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/a1bfd7ba/src/kudu/rpc/inbound_call.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/inbound_call.cc b/src/kudu/rpc/inbound_call.cc
index f837dbc..aba9977 100644
--- a/src/kudu/rpc/inbound_call.cc
+++ b/src/kudu/rpc/inbound_call.cc
@@ -313,5 +313,10 @@ void InboundCall::DiscardTransfer() {
   transfer_.reset();
 }
 
+size_t InboundCall::GetTransferSize() {
+  if (!transfer_) return 0;
+  return transfer_->data().size();
+}
+
 } // namespace rpc
 } // namespace kudu

http://git-wip-us.apache.org/repos/asf/kudu/blob/a1bfd7ba/src/kudu/rpc/inbound_call.h
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/inbound_call.h b/src/kudu/rpc/inbound_call.h
index 20b36ff..6bed18f 100644
--- a/src/kudu/rpc/inbound_call.h
+++ b/src/kudu/rpc/inbound_call.h
@@ -195,6 +195,10 @@ class InboundCall {
   // access sidecars or serialized_request() after this method is called.
   void DiscardTransfer();
 
+  // Returns the size of the transfer buffer that backs this call. If the transfer does
+  // not exist (e.g. GetTransferSize() is called after DiscardTransfer()), returns 0.
+  size_t GetTransferSize();
+
  private:
   friend class RpczStore;
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/a1bfd7ba/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 ac22628..0eef8be 100644
--- a/src/kudu/rpc/rpc-test-base.h
+++ b/src/kudu/rpc/rpc-test-base.h
@@ -185,7 +185,9 @@ class GenericCalculatorService : public ServiceIf {
     resp.set_data2(reinterpret_cast<const char*>(sidecar2.data()), sidecar2.size());
 
     // Drop the sidecars etc, just to confirm that it's safe to do so.
+    CHECK_GT(incoming->GetTransferSize(), 0);
     incoming->DiscardTransfer();
+    CHECK_EQ(0, incoming->GetTransferSize());
     incoming->RespondSuccess(resp);
   }