Jean-Daniel Cryans has uploaded a new patch set (#2).

Change subject: [java client] AsyncKuduClient#delayedSendRpcToTablet should 
return a Deferred
......................................................................

[java client] AsyncKuduClient#delayedSendRpcToTablet should return a Deferred

There's some confusion in the Java client code regarding where Deferred objects
are returned and also sent via an RPC's callback. Such a place is 
delayedSendRpcToTablet,
since it's called from both the context of paths that come from the user
application (need a Deferred) and paths that simply handle background retries 
(don't
need a Deferred since we rely on KuduRpc#callback).

This problem manifested itself in a unit test:
02:15:40.300 [DEBUG - main] (AsyncKuduClient.java:1065) Cannot continue with 
this RPC: Batch{operations=1, tablet="4114911c600b4bc3bbca228f1880568c" 
[<start>, <end>), ignoreAllDuplicateRows=false} because of: RPC can not 
complete before timeout:
org.apache.kudu.client.NonRecoverableException: RPC can not complete before 
timeout: Batch{operations=1, tablet="4114911c600b4bc3bbca228f1880568c" 
[<start>, <end>), ignoreAllDuplicateRows=false}
        at 
org.apache.kudu.client.AsyncKuduClient.tooManyAttemptsOrTimeout(AsyncKuduClient.java:1063)
        at 
org.apache.kudu.client.AsyncKuduClient.delayedSendRpcToTablet(AsyncKuduClient.java:1275)
        at 
org.apache.kudu.client.AsyncKuduClient.sendRpcToTablet(AsyncKuduClient.java:756)
        at 
org.apache.kudu.client.AsyncKuduSession$TabletLookupCB.call(AsyncKuduSession.java:371)
        at 
org.apache.kudu.client.AsyncKuduSession$TabletLookupCB.call(AsyncKuduSession.java:302)
        at com.stumbleupon.async.Deferred.doCall(Deferred.java:1280)
        at com.stumbleupon.async.Deferred.addCallbacks(Deferred.java:685)
        at com.stumbleupon.async.Deferred.addBoth(Deferred.java:769)
        at org.apache.kudu.util.AsyncUtil.addBoth(AsyncUtil.java:59)
        at 
org.apache.kudu.client.AsyncKuduSession.doFlush(AsyncKuduSession.java:436)
        at 
org.apache.kudu.client.AsyncKuduSession.flush(AsyncKuduSession.java:405)
        at 
org.apache.kudu.client.TestAsyncKuduSession.testInsertIntoUnavailableTablet(TestAsyncKuduSession.java:164)

Here the Deferred.fromError that got created in tooManyAttemptsOrTimeout was 
ignored by delayedSendRpcToTablet, then
in sendRpcToTablet we sent back the RPC's Deferred which at that point was 
voided since tooManyAttemptsOrTimeout
_also_ called that RPC's callback.

I tried writing a test, but even with looping on my machine I can't repro the 
issue.

Change-Id: I7c5e87b7dc3366ed9d72121a2421c5cd2304608b
---
M java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduClient.java
1 file changed, 18 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/54/4654/2
-- 
To view, visit http://gerrit.cloudera.org:8080/4654
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I7c5e87b7dc3366ed9d72121a2421c5cd2304608b
Gerrit-PatchSet: 2
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Jean-Daniel Cryans <jdcry...@apache.org>
Gerrit-Reviewer: Adar Dembo <a...@cloudera.com>
Gerrit-Reviewer: Dan Burkert <d...@cloudera.com>
Gerrit-Reviewer: Jean-Daniel Cryans <jdcry...@apache.org>

Reply via email to