You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by aw...@apache.org on 2021/10/26 20:25:59 UTC

[kudu] branch master updated (de02a34 -> 9015ccc)

This is an automated email from the ASF dual-hosted git repository.

awong pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git.


    from de02a34  [encryption] Add encryption support to Env
     new 5ce41d9  [rpc] re-add methods_by_name()
     new 9015ccc  [tablet] fix non-handled switch warning

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/kudu/rpc/rpc-test.cc              | 10 ++++++++++
 src/kudu/rpc/service_if.h             |  5 ++++-
 src/kudu/tablet/ops/participant_op.cc |  7 ++++---
 3 files changed, 18 insertions(+), 4 deletions(-)

[kudu] 02/02: [tablet] fix non-handled switch warning

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 9015ccc162122b0d0a55431957c03fb085bc26c3
Author: Andrew Wong <aw...@cloudera.com>
AuthorDate: Mon Oct 25 19:24:10 2021 -0700

    [tablet] fix non-handled switch warning
    
    This patch addresses the following build warning:
    
    ../../src/kudu/tablet/ops/participant_op.cc: In member function ‘kudu::Status kudu::tablet::ParticipantOpState::PerformOp(const kudu::consensus::OpId&, kudu::tablet::Tablet*)’:
    ../../src/kudu/tablet/ops/participant_op.cc:220:10: warning: enumeration value ‘ParticipantOpPB_ParticipantOpType_GET_METADATA’ not handled in switch [-Wswitch]
         switch (op_type) {
                    ^
    
    Change-Id: I25c05d90dd3716f755ddcd9e842c4080fea277e1
    Reviewed-on: http://gerrit.cloudera.org:8080/17970
    Reviewed-by: Alexey Serbin <as...@cloudera.com>
    Tested-by: Kudu Jenkins
---
 src/kudu/tablet/ops/participant_op.cc | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/kudu/tablet/ops/participant_op.cc b/src/kudu/tablet/ops/participant_op.cc
index a5ed7eb..0bd305d 100644
--- a/src/kudu/tablet/ops/participant_op.cc
+++ b/src/kudu/tablet/ops/participant_op.cc
@@ -252,9 +252,10 @@ Status ParticipantOpState::PerformOp(const consensus::OpId& op_id, Tablet* table
       txn_->ReleasePartitionLock();
       break;
     }
-    case ParticipantOpPB::UNKNOWN: {
-      return Status::InvalidArgument("unknown op type");
-    }
+    default:
+      return Status::InvalidArgument(
+          Substitute("bad op type $0 ($1)",
+                     op_type, ParticipantOpPB::ParticipantOpType_Name(op_type)));
   }
   return Status::OK();
 }

[kudu] 01/02: [rpc] re-add methods_by_name()

Posted by aw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

awong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 5ce41d9075b04a39014ec8445b7cdf0cd2e64b10
Author: Andrew Wong <aw...@cloudera.com>
AuthorDate: Tue Oct 5 13:34:55 2021 -0700

    [rpc] re-add methods_by_name()
    
    This patch reverts the removal of the methods_by_name() accessor method
    from patch 7f794e3ac8c389af4c74faeac11274e4ef0a55c0. Turns out it may be
    used outside the project, in the Apache Impala project[1]. To maintain
    consistency between the two projects, this re-adds the method.
    
    This patch also adds a simple test with this context to deter further
    removals of the call.
    
    [1] https://github.com/apache/impala/blob/b28da054f3595bb92873433211438306fc22fbc7/be/src/rpc/impala-service-pool.cc#L77
    
    Change-Id: I2cbccdbbd119ebd53544d951e45b8bb4d34abae7
    Reviewed-on: http://gerrit.cloudera.org:8080/17969
    Reviewed-by: Alexey Serbin <as...@cloudera.com>
    Tested-by: Andrew Wong <aw...@cloudera.com>
---
 src/kudu/rpc/rpc-test.cc  | 10 ++++++++++
 src/kudu/rpc/service_if.h |  5 ++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/kudu/rpc/rpc-test.cc b/src/kudu/rpc/rpc-test.cc
index bd7adf8..4a3aedd 100644
--- a/src/kudu/rpc/rpc-test.cc
+++ b/src/kudu/rpc/rpc-test.cc
@@ -48,6 +48,7 @@
 #include "kudu/rpc/outbound_call.h"
 #include "kudu/rpc/proxy.h"
 #include "kudu/rpc/reactor.h"
+#include "kudu/rpc/result_tracker.h"
 #include "kudu/rpc/rpc-test-base.h"
 #include "kudu/rpc/rpc_controller.h"
 #include "kudu/rpc/rpc_header.pb.h"
@@ -1059,6 +1060,15 @@ static void AcceptAndReadForever(Socket* listen_sock) {
   }
 }
 
+// Basic test for methods_by_name(). At the time of writing, this isn't used by
+// Kudu, but is used in other projects like Apache Impala.
+TEST_F(TestRpc, TestMethodsByName) {
+  std::unique_ptr<CalculatorService> service(
+      new CalculatorService(metric_entity_, result_tracker_));
+  const auto& methods = service->methods_by_name();
+  ASSERT_EQ(8, methods.size());
+}
+
 // Starts a fake listening socket which never actually negotiates.
 // Ensures that the client gets a reasonable status code in this case.
 TEST_F(TestRpc, TestNegotiationTimeout) {
diff --git a/src/kudu/rpc/service_if.h b/src/kudu/rpc/service_if.h
index 71226db..185e291 100644
--- a/src/kudu/rpc/service_if.h
+++ b/src/kudu/rpc/service_if.h
@@ -114,6 +114,10 @@ class GeneratedServiceIf : public ServiceIf {
 
   RpcMethodInfo* LookupMethod(const RemoteMethod& method) override;
 
+  // Returns the mapping from method names to method infos.
+  typedef std::unordered_map<std::string, scoped_refptr<RpcMethodInfo>> MethodInfoMap;
+  const MethodInfoMap& methods_by_name() const { return methods_by_name_; }
+
  protected:
   explicit GeneratedServiceIf(const scoped_refptr<ResultTracker>& tracker);
 
@@ -124,7 +128,6 @@ class GeneratedServiceIf : public ServiceIf {
   // call. Methods are inserted by the constructor of the generated subclass.
   // After construction, this map is accessed by multiple threads and therefore
   // must not be modified.
-  typedef std::unordered_map<std::string, scoped_refptr<RpcMethodInfo>> MethodInfoMap;
   MethodInfoMap methods_by_name_;
 };