[ 
https://issues.apache.org/jira/browse/HBASE-17465?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15852356#comment-15852356
 ] 

Xiaobing Zhou commented on HBASE-17465:
---------------------------------------

posted v7.
# added unit tests
# simplified generic parameters.
# implemented a bunch of mockup class, .e.g. MockRawAsyncTableImpl, which can 
be used as a base for RawAsyncTableImpl implementation.

Still need to refine tests by completing mockup functions, e.g. 
MockAsyncConnection::GetRegionServerStub, also need to add various 
configuration setting to hit retry implementation for verification.

Usage example in tests:
{code}
/* create hbase client connection */
  auto conn = std::make_shared<MockAsyncConnection>();

  /* create retry caller factory */
  auto tableImpl = 
std::make_shared<MockRawAsyncTableImpl<MockAsyncConnection>>(conn);
  AsyncRpcRetryingCallerFactory<MockAsyncConnection> caller_factory(conn);

  /* create request caller builder */
  auto p = caller_factory.Single<hbase::Result>();

  /* call with retry to get result */
  hbase::Result result =
    p->table(std::make_shared<TableName>(tn))
     ->row(row)
     ->rpc_timeout(conn->get_conn_conf()->GetReadRpcTimeoutNs())
     ->operation_timeout(conn->get_conn_conf()->GetOperationTimeoutNs())
     ->action(
        [=, &get](auto& controller, auto& loc, auto& stub) -> 
folly::Future<hbase::Result> {
          return tableImpl->GetCall(stub, controller, loc, get);})
     ->Build()->Call().get();

  /* verify result */
  ASSERT_TRUE(!result->IsEmpty()) << "Result shouldn't be empty.";
  EXPECT_EQ("test2", result->Row());
  EXPECT_EQ("value2", *(result->Value("d", "2")));
  EXPECT_EQ("value for extra", *(result->Value("d", "extra")));

  /* clean */
  delete test_util;
{code}

> [C++] implement request retry mechanism over RPC
> ------------------------------------------------
>
>                 Key: HBASE-17465
>                 URL: https://issues.apache.org/jira/browse/HBASE-17465
>             Project: HBase
>          Issue Type: Sub-task
>            Reporter: Xiaobing Zhou
>            Assignee: Xiaobing Zhou
>         Attachments: HBASE-17465-HBASE-14850.000.patch, 
> HBASE-17465-HBASE-14850.001.patch, HBASE-17465-HBASE-14850.002.patch, 
> HBASE-17465-HBASE-14850.003.patch, HBASE-17465-HBASE-14850.004.patch, 
> HBASE-17465-HBASE-14850.005.patch, HBASE-17465-HBASE-14850.006.patch, 
> HBASE-17465-HBASE-14850.007.patch
>
>
> HBASE-17051 implemented RPC layer. Requests retries will make system 
> reliable. This JIRA proposes adding it, which corresponds to similar 
> implementation in  SingleRequestCallerBuilder (or BatchCallerBuilder, 
> ScanSingleRegionCallerBuilder, SmallScanCallerBuilder, etc.) and 
> AsyncSingleRequestRpcRetryingCaller. As a bonus, retry should be more 
> generic, decoupled with HRegionLocation.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to