You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Toshihiro Suzuki (Jira)" <ji...@apache.org> on 2020/08/13 00:39:00 UTC

[jira] [Updated] (HBASE-24650) Change the return types of the new checkAndMutate methods introduced in HBASE-8458

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

Toshihiro Suzuki updated HBASE-24650:
-------------------------------------
    Release Note: 
HBASE-24650 introduced CheckAndMutateResult class and changed the return type of checkAndMutate methods to this class in order to support CheckAndMutate with Increment/Append.

The new APIs for the Table interface:
```
/**
 * checkAndMutate that atomically checks if a row matches the specified condition. If it does,
 * it performs the specified action.
 *
 * @param checkAndMutate The CheckAndMutate object.
 * @return A CheckAndMutateResult object that represents the result for the CheckAndMutate.
 * @throws IOException if a remote or network exception occurs.
 */
default CheckAndMutateResult checkAndMutate(CheckAndMutate checkAndMutate) throws IOException {
  return checkAndMutate(Collections.singletonList(checkAndMutate)).get(0);
}

/**
 * Batch version of checkAndMutate. The specified CheckAndMutates are batched only in the sense
 * that they are sent to a RS in one RPC, but each CheckAndMutate operation is still executed
 * atomically (and thus, each may fail independently of others).
 *
 * @param checkAndMutates The list of CheckAndMutate.
 * @return A list of CheckAndMutateResult objects that represents the result for each
 *   CheckAndMutate.
 * @throws IOException if a remote or network exception occurs.
 */
default List<CheckAndMutateResult> checkAndMutate(List<CheckAndMutate> checkAndMutates)
  throws IOException {
  throw new NotImplementedException("Add an implementation!");
}
{code}

The new APIs for the AsyncTable interface:
{code}
/**
 * checkAndMutate that atomically checks if a row matches the specified condition. If it does,
 * it performs the specified action.
 *
 * @param checkAndMutate The CheckAndMutate object.
 * @return A {@link CompletableFuture}s that represent the result for the CheckAndMutate.
 */
CompletableFuture<CheckAndMutateResult> checkAndMutate(CheckAndMutate checkAndMutate);

/**
 * Batch version of checkAndMutate. The specified CheckAndMutates are batched only in the sense
 * that they are sent to a RS in one RPC, but each CheckAndMutate operation is still executed
 * atomically (and thus, each may fail independently of others).
 *
 * @param checkAndMutates The list of CheckAndMutate.
 * @return A list of {@link CompletableFuture}s that represent the result for each
 *   CheckAndMutate.
 */
List<CompletableFuture<CheckAndMutateResult>> checkAndMutate(
  List<CheckAndMutate> checkAndMutates);

/**
 * A simple version of batch checkAndMutate. It will fail if there are any failures.
 *
 * @param checkAndMutates The list of rows to apply.
 * @return A {@link CompletableFuture} that wrapper the result list.
 */
default CompletableFuture<List<CheckAndMutateResult>> checkAndMutateAll(
  List<CheckAndMutate> checkAndMutates) {
  return allOf(checkAndMutate(checkAndMutates));
}
```


  was:
HBASE-24650 introduced CheckAndMutateResult class and changed the return type of checkAndMutate methods to this class in order to support CheckAndMutate with Increment/Append.

The new APIs for the Table interface:
{code}
/**
 * checkAndMutate that atomically checks if a row matches the specified condition. If it does,
 * it performs the specified action.
 *
 * @param checkAndMutate The CheckAndMutate object.
 * @return A CheckAndMutateResult object that represents the result for the CheckAndMutate.
 * @throws IOException if a remote or network exception occurs.
 */
default CheckAndMutateResult checkAndMutate(CheckAndMutate checkAndMutate) throws IOException {
  return checkAndMutate(Collections.singletonList(checkAndMutate)).get(0);
}

/**
 * Batch version of checkAndMutate. The specified CheckAndMutates are batched only in the sense
 * that they are sent to a RS in one RPC, but each CheckAndMutate operation is still executed
 * atomically (and thus, each may fail independently of others).
 *
 * @param checkAndMutates The list of CheckAndMutate.
 * @return A list of CheckAndMutateResult objects that represents the result for each
 *   CheckAndMutate.
 * @throws IOException if a remote or network exception occurs.
 */
default List<CheckAndMutateResult> checkAndMutate(List<CheckAndMutate> checkAndMutates)
  throws IOException {
  throw new NotImplementedException("Add an implementation!");
}
{code}

The new APIs for the AsyncTable interface:
{code}
/**
 * checkAndMutate that atomically checks if a row matches the specified condition. If it does,
 * it performs the specified action.
 *
 * @param checkAndMutate The CheckAndMutate object.
 * @return A {@link CompletableFuture}s that represent the result for the CheckAndMutate.
 */
CompletableFuture<CheckAndMutateResult> checkAndMutate(CheckAndMutate checkAndMutate);

/**
 * Batch version of checkAndMutate. The specified CheckAndMutates are batched only in the sense
 * that they are sent to a RS in one RPC, but each CheckAndMutate operation is still executed
 * atomically (and thus, each may fail independently of others).
 *
 * @param checkAndMutates The list of CheckAndMutate.
 * @return A list of {@link CompletableFuture}s that represent the result for each
 *   CheckAndMutate.
 */
List<CompletableFuture<CheckAndMutateResult>> checkAndMutate(
  List<CheckAndMutate> checkAndMutates);

/**
 * A simple version of batch checkAndMutate. It will fail if there are any failures.
 *
 * @param checkAndMutates The list of rows to apply.
 * @return A {@link CompletableFuture} that wrapper the result list.
 */
default CompletableFuture<List<CheckAndMutateResult>> checkAndMutateAll(
  List<CheckAndMutate> checkAndMutates) {
  return allOf(checkAndMutate(checkAndMutates));
}
{code}


> Change the return types of the new checkAndMutate methods introduced in HBASE-8458
> ----------------------------------------------------------------------------------
>
>                 Key: HBASE-24650
>                 URL: https://issues.apache.org/jira/browse/HBASE-24650
>             Project: HBase
>          Issue Type: Sub-task
>          Components: Client
>            Reporter: Toshihiro Suzuki
>            Assignee: Toshihiro Suzuki
>            Priority: Major
>             Fix For: 3.0.0-alpha-1, 2.4.0
>
>
> To support CheckAndMutate with Increment/Append, the new checkAndMutate methods introduced in HBASE-8458 need to return the result of the specified Increment/Append operation in addition to a boolean value represents whether it's successful or not. Currently, the methods return only boolean value(s), so we need to change the return types of the methods. The methods are unreleased yet currently, so I think it's no problem to change the return types of the methods.



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