You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by nk...@apache.org on 2013/08/24 07:54:58 UTC

svn commit: r1517108 - /hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java

Author: nkeywal
Date: Sat Aug 24 05:54:57 2013
New Revision: 1517108

URL: http://svn.apache.org/r1517108
Log:
HBASE-9268  Client doesn't recover from a stalled region server

Modified:
    hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java

Modified: hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java?rev=1517108&r1=1517107&r2=1517108&view=diff
==============================================================================
--- hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java (original)
+++ hbase/trunk/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java Sat Aug 24 05:54:57 2013
@@ -144,7 +144,10 @@ public class RpcClient {
   public static final boolean IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_DEFAULT = false;
 
   // thread-specific RPC timeout, which may override that of what was passed in.
-  // TODO: Verify still being used.
+  // This is used to change dynamically the timeout (for read only) when retrying: if
+  //  the time allowed for the operation is less than the usual socket timeout, then
+  //  we lower the timeout. This is subject to race conditions, and should be used with
+  //  extreme caution.
   private static ThreadLocal<Integer> rpcTimeout = new ThreadLocal<Integer>() {
     @Override
     protected Integer initialValue() {
@@ -846,7 +849,10 @@ public class RpcClient {
         while (true) {
           setupConnection();
           InputStream inStream = NetUtils.getInputStream(socket);
-          OutputStream outStream = NetUtils.getOutputStream(socket);
+          // This creates a socket with a write timeout. This timeout cannot be changed,
+          //  RpcClient allows to change the timeout dynamically, but we can only
+          //  change the read timeout today.
+          OutputStream outStream = NetUtils.getOutputStream(socket, pingInterval);
           // Write out the preamble -- MAGIC, version, and auth to use.
           writeConnectionHeaderPreamble(outStream);
           if (useSasl) {