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

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

[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>
(cherry picked from commit d002e3257d49fe8e420c3d50eac54bb2d1952722)
Reviewed-on: http://gerrit.cloudera.org:8080/3457
Reviewed-by: Jean-Daniel Cryans <jd...@apache.org>


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

Branch: refs/heads/branch-0.9.x
Commit: 35856378af449f8a65acf5c4954ca74d82f67c39
Parents: 395ec56
Author: Dan Burkert <da...@cloudera.com>
Authored: Tue Jun 7 15:41:04 2016 -0700
Committer: Todd Lipcon <to...@apache.org>
Committed: Thu Jun 23 02:06:42 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/35856378/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);