Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-24602

Add Increment and Append support to CheckAndMutate

    XMLWordPrintableJSON

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0.0-alpha-1, 2.4.0
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      Incompatible change, Reviewed
    • Release Note:
      Hide
      Summary of the change of HBASE-24602:
      - Add `build(Increment)` and `build(Append)` methods to the `Builder` class of the `CheckAndMutate` class. After this change, we can perform checkAndIncrement/Append operations as follows:
      ```
      // Build a CheckAndMutate object with a Increment object
      CheckAndMutate checkAndMutate = CheckAndMutate.newBuilder(row)
        .ifEquals(family, qualifier, value)
        .build(increment);

      // Perform a CheckAndIncrement operation
      CheckAndMutateResult checkAndMutateResult = table.checkAndMutate(checkAndMutate);

      // Get whether or not the CheckAndIncrement operation is successful
      boolean success = checkAndMutateResult.isSuccess();

      // Get the result of the increment operation
      Result result = checkAndMutateResult.getResult();
      ```
      - After this change, `HRegion.batchMutate()` is used for increment/append operations.
      - As the side effect of the above change, the following coprocessor methods of RegionObserver are called when increment/append operations are performed:
        - preBatchMutate()
        - postBatchMutate()
        - postBatchMutateIndispensably()
      Show
      Summary of the change of HBASE-24602 : - Add `build(Increment)` and `build(Append)` methods to the `Builder` class of the `CheckAndMutate` class. After this change, we can perform checkAndIncrement/Append operations as follows: ``` // Build a CheckAndMutate object with a Increment object CheckAndMutate checkAndMutate = CheckAndMutate.newBuilder(row)   .ifEquals(family, qualifier, value)   .build(increment); // Perform a CheckAndIncrement operation CheckAndMutateResult checkAndMutateResult = table.checkAndMutate(checkAndMutate); // Get whether or not the CheckAndIncrement operation is successful boolean success = checkAndMutateResult.isSuccess(); // Get the result of the increment operation Result result = checkAndMutateResult.getResult(); ``` - After this change, `HRegion.batchMutate()` is used for increment/append operations. - As the side effect of the above change, the following coprocessor methods of RegionObserver are called when increment/append operations are performed:   - preBatchMutate()   - postBatchMutate()   - postBatchMutateIndispensably()

      Description

      Currently, CheckAndMutate supports only Put and Delete. Supporting Increment and Append would be helpful for some use cases.

        Attachments

          Activity

            People

            • Assignee:
              brfrn169 Toshihiro Suzuki
              Reporter:
              brfrn169 Toshihiro Suzuki
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: