You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by jd...@apache.org on 2017/02/17 17:40:19 UTC

[2/2] kudu git commit: KUDU-1888. java: fix handling of RPCs which fail before they are sent

KUDU-1888. java: fix handling of RPCs which fail before they are sent

As described in the bug report, this fixes a race where, if an RPC was
sent when it had already timed out (eg due to overloaded CPU) it would
return a deferred error, and call the RPC's errback, but the returned
deferred would not actually be the same object as the RPC deferred. This
means that adding additional errbacks to the return value would not be
able to transform the result of the RPC.

Change-Id: I85ef2a215becb84c805e62f0da229b901e109193
Reviewed-on: http://gerrit.cloudera.org:8080/6051
Tested-by: Kudu Jenkins
Reviewed-by: Jean-Daniel Cryans <jd...@apache.org>


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

Branch: refs/heads/master
Commit: f0af095e575e383269e5b47f5f197a91b1b2d675
Parents: 7b695d9
Author: Todd Lipcon <to...@apache.org>
Authored: Thu Feb 16 22:03:46 2017 -0800
Committer: Jean-Daniel Cryans <jd...@apache.org>
Committed: Fri Feb 17 17:37:46 2017 +0000

----------------------------------------------------------------------
 .../src/main/java/org/apache/kudu/client/AsyncKuduClient.java  | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/f0af095e/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduClient.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduClient.java b/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduClient.java
index 72df1b1..6f404a1 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduClient.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduClient.java
@@ -685,8 +685,9 @@ public class AsyncKuduClient implements AutoCloseable {
                                                  entry.getUpperBoundPartitionKey());
       // Sending both as an errback and returning fromError because sendRpcToTablet might be
       // called via a callback that won't care about the returned Deferred.
+      Deferred<R> d = request.getDeferred();
       request.errback(e);
-      return Deferred.fromError(e);
+      return d;
     }
 
     // Set the propagated timestamp so that the next time we send a message to
@@ -1005,8 +1006,9 @@ public class AsyncKuduClient implements AutoCloseable {
     Status statusTimedOut = Status.TimedOut(message + request);
     final Exception e = new NonRecoverableException(statusTimedOut, cause);
     LOG.debug("Cannot continue with this RPC: {} because of: {}", request, message, e);
+    Deferred<R> d = request.getDeferred();
     request.errback(e);
-    return Deferred.fromError(e);
+    return d;
   }
 
   /**