You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by da...@apache.org on 2016/06/08 02:02:34 UTC

incubator-kudu git commit: [java-client] RPC timeout may sometimes be reported as max attempts violation

Repository: incubator-kudu
Updated Branches:
  refs/heads/master e4833d2df -> d002e3257


[java-client] RPC timeout may sometimes be reported as max attempts violation

Fixes an issue where an RPC timeout could be reported in the error message as
too many attempts.

Change-Id: I9c5676ab5bd05170505ef0313b919c5475ae6b37
Reviewed-on: http://gerrit.cloudera.org:8080/3330
Tested-by: Kudu Jenkins
Reviewed-by: Dan Burkert <da...@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kudu/commit/d002e325
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kudu/tree/d002e325
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kudu/diff/d002e325

Branch: refs/heads/master
Commit: d002e3257d49fe8e420c3d50eac54bb2d1952722
Parents: e4833d2
Author: Dan Burkert <da...@cloudera.com>
Authored: Tue Jun 7 15:41:04 2016 -0700
Committer: Dan Burkert <da...@cloudera.com>
Committed: Wed Jun 8 01:58:27 2016 +0000

----------------------------------------------------------------------
 .../src/main/java/org/kududb/client/AsyncKuduClient.java    | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/d002e325/java/kudu-client/src/main/java/org/kududb/client/AsyncKuduClient.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/kududb/client/AsyncKuduClient.java b/java/kudu-client/src/main/java/org/kududb/client/AsyncKuduClient.java
index f53b946..d1d74b9 100644
--- a/java/kudu-client/src/main/java/org/kududb/client/AsyncKuduClient.java
+++ b/java/kudu-client/src/main/java/org/kududb/client/AsyncKuduClient.java
@@ -128,6 +128,7 @@ public class AsyncKuduClient implements AutoCloseable {
   public static final long NO_TIMESTAMP = -1;
   public static final long DEFAULT_OPERATION_TIMEOUT_MS = 30000;
   public static final long DEFAULT_SOCKET_READ_TIMEOUT_MS = 10000;
+  private static final long MAX_RPC_ATTEMPTS = 100;
 
   private final ClientSocketChannelFactory channelFactory;
 
@@ -984,7 +985,7 @@ public class AsyncKuduClient implements AutoCloseable {
    * already.
    */
   static boolean cannotRetryRequest(final KuduRpc<?> rpc) {
-    return rpc.deadlineTracker.timedOut() || rpc.attempt > 100;  // TODO Don't hardcode.
+    return rpc.deadlineTracker.timedOut() || rpc.attempt > MAX_RPC_ATTEMPTS;
   }
 
   /**
@@ -997,10 +998,10 @@ public class AsyncKuduClient implements AutoCloseable {
   static <R> Deferred<R> tooManyAttemptsOrTimeout(final KuduRpc<R> request,
                                                   final KuduException cause) {
     String message;
-    if (request.deadlineTracker.timedOut()) {
-      message = "Time out: ";
-    } else {
+    if (request.attempt > MAX_RPC_ATTEMPTS) {
       message = "Too many attempts: ";
+    } else {
+      message = "RPC can not complete before timeout: ";
     }
     final Exception e = new NonRecoverableException(message + request, cause);
     request.errback(e);