You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "guanyun (Jira)" <ji...@apache.org> on 2019/12/08 13:35:03 UTC

[jira] [Created] (HBASE-23506) CLONE - [C++] make RPC test mode transparent to initialization of RpcPipeline

guanyun created HBASE-23506:
-------------------------------

             Summary: CLONE - [C++] make RPC test mode transparent to initialization of RpcPipeline
                 Key: HBASE-23506
                 URL: https://issues.apache.org/jira/browse/HBASE-23506
             Project: HBase
          Issue Type: Sub-task
            Reporter: guanyun


This is a follow up work of HBASE-18338.
In RpcPipelineFactory::newPipeline, the HBASE_CLIENT_RPC_TEST_MODE is used to exclude SaslHandler which otherwise will cause RpcTestServer not receiving any requests.

{code}
+  if (!conf_->GetBool(
+      Configuration::HBASE_CLIENT_RPC_TEST_MODE,
+      Configuration::DEFAULT_HBASE_CLIENT_RPC_TEST_MODE)) {
+    secure = security::User::IsSecurityEnabled(*conf_);
+    pipeline->addBack(SaslHandler{user_util_.user_name(secure), conf_});
+  }
{code}

This is not clean. Handlers should be added to pipeline regardless of test or not, instead, every handler can choose to discriminate test or not. Taking ClientHandler as an example:
{code}
folly::Future<folly::Unit> ClientHandler::write(Context *ctx, std::unique_ptr<Request> r) {
  /* for RPC test, there's no need to send connection header */
  if (!conf_->GetBool(RpcSerde::HBASE_CLIENT_RPC_TEST_MODE,
                      RpcSerde::DEFAULT_HBASE_CLIENT_RPC_TEST_MODE)) {
    // We need to send the header once.
    // So use call_once to make sure that only one thread wins this.
    std::call_once((*once_flag_), [ctx, this]() {
      VLOG(3) << "Writing RPC Header to server: " << server_;
      auto header = serde_.Header(user_name_);
      ctx->fireWrite(std::move(header));
    });
  }
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)