[
https://issues.apache.org/jira/browse/HBASE-18535?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andrew Kyle Purtell closed HBASE-18535.
---------------------------------------
> [C++] make RPC test mode transparent to initialization of RpcPipeline
> ---------------------------------------------------------------------
>
> Key: HBASE-18535
> URL: https://issues.apache.org/jira/browse/HBASE-18535
> Project: HBase
> Issue Type: Sub-task
> Reporter: Xiaobing Zhou
> Priority: Major
>
> 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.20.7#820007)