HBase
  1. HBase
  2. HBASE-4999

Constraints - Enhance checkAndPut to do atomic arbitrary constraint checks

    Details

    • Tags:
      constraints, CAS

      Description

      Related work: HBASE-4605

      It would be great if checkAndPut (CAS) can be enhanced to not just use a value comparison as a gating factor for the put, but rather have the capability of doing arbitrary constraint checks on the column value (where the current comparinator approach is a subset of possible constraints that can be checked). Commonly used constraints (like comparisons) can be provided out of the box and we should have the ability to accept custom constraints set by the client for the checkAndPut call.

      One use-case would be the ability to implement something like the below in HBase.
      Pseudo sql:
      update table-name
      set column-name = new-value
      where (column-value - new-value) > threshold-value

      ... where the mutation would go through only if the specified constraint in the where clause is true.

      Current options include using a co-processor to do preCheckAndPut/postCheckAndPut constraint checks - but this is not atomic. i.e. the row lock needs to be released by the co-processor before the real checkAndPut call, thus not meeting the atomic requirement.

      Everything above is still meant to be at row level (so, no cross-row constraint checking is implied here).

      And ideal end result would be that an HBase client would be able to specify a set of constraints on multiple column qualifiers as part of the checkAndPut call. The call goes through if all the constraints are satisfied or doesn't if any of the constraints fail. And the above checkAndPut should be atomically executed (just like current checkAndPut semantics).

        Issue Links

          Activity

          Suraj Varma created issue -
          Jesse Yates made changes -
          Field Original Value New Value
          Link This issue is blocked by HBASE-4605 [ HBASE-4605 ]
          Suraj Varma made changes -
          Fix Version/s 0.94.0 [ 12316419 ]
          Affects Version/s 0.92.0 [ 12314223 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              Suraj Varma
            • Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:

                Development