You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by li...@apache.org on 2014/05/14 02:33:22 UTC

svn commit: r1594426 - /hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/ipc/thrift/ThriftClientObjectFactory.java

Author: liyin
Date: Wed May 14 00:33:21 2014
New Revision: 1594426

URL: http://svn.apache.org/r1594426
Log:
[HBASE-9704] Fail the client creation if it fails for more than rpcTimeout

Author: manukranthk

Summary: While creating the thrift client, the get() on the future waits indefinitely. Instead, waiting with a timeout equal to the RPC timeout makes more sense. Ideally, this should be done internally in thrift.

Test Plan: Test on calypsohbase001-frc1

Reviewers: rshroff, adela, daviddeng

Reviewed By: daviddeng

CC: hbase-eng@

Differential Revision: https://phabricator.fb.com/D1314459

Task ID: 4253558

Modified:
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/ipc/thrift/ThriftClientObjectFactory.java

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/ipc/thrift/ThriftClientObjectFactory.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/ipc/thrift/ThriftClientObjectFactory.java?rev=1594426&r1=1594425&r2=1594426&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/ipc/thrift/ThriftClientObjectFactory.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/ipc/thrift/ThriftClientObjectFactory.java Wed May 14 00:33:21 2014
@@ -93,14 +93,16 @@ public class ThriftClientObjectFactory e
     ThriftClient<? extends ThriftClientInterface> newClient = new ThriftClient<>(
       clientManager, clazz, thriftClientConfig,
         clazz.getName());
-
+    long rpcTimeout = conf.getLong(HConstants.HBASE_RPC_TIMEOUT_KEY,
+        HConstants.DEFAULT_HBASE_RPC_TIMEOUT);
     if (useHeaderProtocol) {
-      return newClient.open(new HeaderClientConnector(address)).get();
+      return newClient.open(new HeaderClientConnector(address))
+          .get(rpcTimeout, TimeUnit.MILLISECONDS);
     } else {
       return newClient.open(
           new FramedClientConnector(address, TDuplexProtocolFactory
               .fromSingleFactory(new TFacebookCompactProtocol.Factory())))
-          .get();
+              .get(rpcTimeout, TimeUnit.MILLISECONDS);
     }
   }