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 2016/05/06 02:36:04 UTC
[2/2] incubator-kudu git commit: [java client] scanNextRows() needs
to always increment attempts
[java client] scanNextRows() needs to always increment attempts
This bug was introduced in c4180bb, we call something that checks getSleepTimeForRpc
but we don't increment the attempt. If the client is null or dead, on the first call,
then the attempt will still be set to 0.
Discovered in a TestAsyncKuduClient#testDisconnect failure.
Change-Id: I8a726adb82ade80f241128e7c61091e6af2d9c13
Reviewed-on: http://gerrit.cloudera.org:8080/2973
Reviewed-by: Dan Burkert <da...@cloudera.com>
Tested-by: Jean-Daniel Cryans
Project: http://git-wip-us.apache.org/repos/asf/incubator-kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kudu/commit/93ff8fc5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kudu/tree/93ff8fc5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kudu/diff/93ff8fc5
Branch: refs/heads/master
Commit: 93ff8fc5c4c4afc322a7039c0151987dd22df27e
Parents: 20d2217
Author: Jean-Daniel Cryans <jd...@apache.org>
Authored: Thu May 5 15:48:54 2016 -0700
Committer: Jean-Daniel Cryans <jd...@gerrit.cloudera.org>
Committed: Fri May 6 02:35:26 2016 +0000
----------------------------------------------------------------------
.../src/main/java/org/kududb/client/AsyncKuduClient.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/93ff8fc5/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 3e7fe69..ee56f1d 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
@@ -620,6 +620,9 @@ public class AsyncKuduClient implements AutoCloseable {
final TabletClient client = clientFor(tablet);
final KuduRpc<AsyncKuduScanner.Response> next_request = scanner.getNextRowsRequest();
final Deferred<AsyncKuduScanner.Response> d = next_request.getDeferred();
+ // Important to increment the attempts before the next if statement since
+ // getSleepTimeForRpc() relies on it if the client is null or dead.
+ next_request.attempt++;
if (client == null || !client.isAlive()) {
// A null client means we either don't know about this tablet anymore (unlikely) or we
// couldn't find a leader (which could be triggered by a read timeout).
@@ -627,7 +630,6 @@ public class AsyncKuduClient implements AutoCloseable {
delayedSendRpcToTablet(next_request, null);
return next_request.getDeferred();
}
- next_request.attempt++;
client.sendRpc(next_request);
return d;
}