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

Toshihiro Suzuki edited comment on HBASE-25797 at 5/5/21, 2:07 PM:
-------------------------------------------------------------------

[~bryson] Thank you for sharing the code. But I just realized that you are 
using different versions between client and server. Can you please use the same 
version? And note that hbase-2.2.6 doesn't support batch version of 
checkAndMutate(). We support that feature from hbase-2.4.0.

Please see the following Jira for the details:
https://issues.apache.org/jira/browse/HBASE-8458


was (Author: brfrn169):
[~bryson] Thank you for sharing the code. But I just realized that you are 
using different versions between client and server. Can you please use the same 
version? And note that hbase-2.2.6 doesn't support batch version of 
checkAndMutate(). We support that feature from hbase-2.4.0:

Please see the following Jira for the details:
https://issues.apache.org/jira/browse/HBASE-8458

> Batch version of checkAndMutate on AsyncTable always returns false
> ------------------------------------------------------------------
>
>                 Key: HBASE-25797
>                 URL: https://issues.apache.org/jira/browse/HBASE-25797
>             Project: HBase
>          Issue Type: Bug
>          Components: Client
>    Affects Versions: 2.4.1
>            Reporter: Hochul Shin
>            Assignee: Toshihiro Suzuki
>            Priority: Minor
>              Labels: bug
>
> Batch version of CheckAndMutate always returns false whereas non-batch 
> version works fine. 
> The code is like: 
>  
> {code:java}
> AysncTable<?> table = connection.getTable(tableName, executorService);
> ...
> // add r1
> table.put(Arrays.asList(
>  new Put(Bytes.toBytes("r1")).addColumn(COL_FAMILY, Bytes.toBytes("q1"), 
> Bytes.toBytes("v1"))));
> CheckAndMutate checkAndMutate1 = 
> CheckAndMutate.newBuilder(Bytes.toBytes("r1"))
>  .ifNotExists(COL_FAMILY, Bytes.toBytes("q1"))
>  .build(new Put(Bytes.toBytes("r1")).addColumn(COL_FAMILY, 
> Bytes.toBytes("q1"), Bytes.toBytes("v1")));
> CheckAndMutate checkAndMutate2 = 
> CheckAndMutate.newBuilder(Bytes.toBytes("r2"))
>  .ifNotExists(COL_FAMILY, Bytes.toBytes("q2"))
>  .build(new Put(Bytes.toBytes("r2")).addColumn(COL_FAMILY, 
> Bytes.toBytes("q2"), Bytes.toBytes("v2")));
> {code}
>  
> With batch version of checkAndMutate
> {code:java}
> List<CompletableFuture<CheckAndMutateResult>> results =
>     table.checkAndMutate(Arrays.asList(checkAndMutate1, checkAndMutate2));
> System.out.println("first: " + results.get(0).join().isSuccess());  // false
> System.out.println("second: " + results.get(1).join().isSuccess()); //false!
> {code}
>  
>  
> Even it returned false, the r1 was written to the table. (timestamp was 
> updated) 
>  
> With non-batch version of checkAndMutate
>  
> {code:java}
> CompletableFuture<CheckAndMutateResult> result1 = 
> table.checkAndMutate(checkAndMutate1);
>  CompletableFuture<CheckAndMutateResult> result2 = 
> table.checkAndMutate(checkAndMutate2);
> System.out.println("first: " + result1.join().isSuccess()); // false 
> System.out.println("second: " + result2.join().isSuccess()); // true as 
> expected
> {code}
>  
> As expected r1 wasn't written to the table. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to