You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "Viraj Jasani (Jira)" <ji...@apache.org> on 2021/04/22 06:30:00 UTC

[jira] [Resolved] (HBASE-25796) Batch version of checkAndMutate on AsyncTable always returns false

     [ https://issues.apache.org/jira/browse/HBASE-25796?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Viraj Jasani resolved HBASE-25796.
----------------------------------
    Resolution: Duplicate

Marked duplicate of HBASE-25797.

> Batch version of checkAndMutate on AsyncTable always returns false
> ------------------------------------------------------------------
>
>                 Key: HBASE-25796
>                 URL: https://issues.apache.org/jira/browse/HBASE-25796
>             Project: HBase
>          Issue Type: Bug
>          Components: Client
>    Affects Versions: 2.4.1
>            Reporter: Hochul Shin
>            Priority: Minor
>
> Batch version of CheckAndMutate always returns false whereas non-batch version works fine. 
> The code is like: 
> ```
> 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")));
> ```
> With batch version of checkAndMutate
> ```
> 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!
> ```
> Even it returned false, the item was written to the table. 
>  
> With non-batch version of checkAndMutate
> ```
> 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
> ```
> As expected r1 wasn't written to the table. 



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