[
https://issues.apache.org/jira/browse/HBASE-29217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17939883#comment-17939883
]
Xuesen Liang edited comment on HBASE-29217 at 4/1/25 4:16 AM:
--------------------------------------------------------------
Regarding the _CheckAndMutate_ scenario, the filter is primarily used when the
row exists. Implementing a _RowNonExistsFilter_ may not be a good approach.
Your suggestion of using a special 'empty' cell is excellent; however, backward
compatibility poses a significant challenge.
Could you please share any potential risks or pitfalls that might be associated
with the proposed _ifMatchesOrNonExists_ API?
Thanks.
was (Author: liangxs):
Regarding the _CheckAndMutate_ scenario, the filter is primarily used when the
row exists. Implementing a _RowNonExistsFilter_ may not be a good approach.
Your suggestion of using a special 'empty' cell is excellent; however, backward
compatibility poses a significant challenge.
Could you please share any potential risks or pitfalls that might be associated
with the proposed _ifNonExistsOrMatches_ API?
Thanks.
> Enhancement for CheckAndMutate
> ------------------------------
>
> Key: HBASE-29217
> URL: https://issues.apache.org/jira/browse/HBASE-29217
> Project: HBase
> Issue Type: Improvement
> Components: Client, regionserver
> Reporter: Xuesen Liang
> Assignee: Xuesen Liang
> Priority: Major
> Labels: pull-request-available
>
> The current implementation of _CheckAndMutate_ operation provides two
> conditional verification modes:
> 1. Column Non-exists:
> {code:java}
> ifMatches(family, qualifier, CompareOperator.EQUAL, null)
> {code}
> Validates that the specified column does not exist.
> 2. Column Value Comparison/Filter
> {code:java}
> ifMatches(family, qualifier, CompareOperator, value)
> {code}
> OR
> {code:java}
> ifMatches(Filter)
> {code}
> Verifies that the column exists and satisfies the defined comparison/filter
> logic.
>
> *Limitation:*
> The existing API lacks support for composite conditional checks of the form:
> _"Column X either does not exist, OR exists and meets comparison condition"._
>
> *Current Workaround & Risks:*
> To implement this logic, developers must:
> {code:java}
> // Step 1: Check column absence
> checkAndMutate.ifMatches(family, qualifier, CompareOperator.EQUAL, null)
> // Step 2: Check value condition if Step 1 fails
> checkAndMutate.ifMatches(family, qualifier, CompareOperator, value)
> {code}
> This approach introduces following critical issues:
> * Non-atomic Execution: The two-phase check creates race conditions.
> * API Complexity: Forces developers to implement client-side synchronization
> logic.
> * Performance: There are two RPC calls.
>
> *Proposed Solution:*
> Introduce a composite conditional operator:
> {code:java}
> ifNotExistsOr(family, qualifier, CompareOperator, value)
> {code}
>
> *Implementation Benefits:*
> * Atomic Guarantee: Executes the "NOT EXISTS OR SATISFIES" logic in a single
> RPC call.
> * API Simplification: Reduces client-side code complexity.
> This enhancement would align HBase's conditional mutation capabilities with
> modern database systems supporting compound atomic predicates, while
> maintaining backward compatibility.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)