[ 
https://issues.apache.org/jira/browse/KUDU-1270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16863361#comment-16863361
 ] 

Will Berkeley commented on KUDU-1270:
-------------------------------------

[~mpercy] Do you have a suggestion for what should be done? I think the docs 
are clear on the different semantics. The confusing part is that one method 
changes its semantics based on the flush mode, but we are stuck with that 
because the API must remain compatible.

> java client: Confusing semantics for writers
> --------------------------------------------
>
>                 Key: KUDU-1270
>                 URL: https://issues.apache.org/jira/browse/KUDU-1270
>             Project: Kudu
>          Issue Type: Bug
>          Components: client
>    Affects Versions: Public beta
>            Reporter: Mike Percy
>            Priority: Trivial
>
> The behavior of the Java client is pretty confusing when it comes to errors. 
> The javadoc for {{KuduSession.Flush()}} indicates that "if any errors 
> occurred" then an Exception will be thrown. However if there is a key error 
> then you have to look at the results that come back for errors.
> At the time of writing, this is what the API docs say:
> public OperationResponse apply(Operation operation) throws Exception
> Blocking call with a different behavior based on the flush mode. 
> PleaseThrottleException is managed by this method and will not be thrown, 
> unlike AsyncKuduSession.apply(org.kududb.client.Operation).
> AUTO_FLUSH_SYNC: the call returns when the operation is persisted, else it 
> throws an exception.
> AUTO_FLUSH_BACKGROUND: the call returns when the operation has been added to 
> the buffer. The operation's state is then unreachable, meaning that there's 
> no way to know if the operation is persisted. This call should normally 
> perform only fast in-memory operations but it may have to wait when the 
> buffer is full and there's another buffer being flushed.
> MANUAL_FLUSH: the call returns when the operation has been added to the 
> buffer, else it throws an exception such as a NonRecoverableException if the 
> buffer is full.
> Parameters:
> operation - operation to apply
> Returns:
> an OperationResponse for the applied Operation
> Throws:
> Exception - if anything went wrong
> public List<OperationResponse> flush()
>                               throws Exception
> Blocking call that force flushes this session's buffers. Data is persisted 
> when this call returns, else it will throw an exception.
> Returns:
> a list of OperationResponse, one per operation that was flushed
> Throws:
> Exception - if anything went wrong. If it's an issue with some or all 
> batches, it will be of type DeferredGroupException.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to