[
https://issues.apache.org/jira/browse/HBASE-29217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17939640#comment-17939640
]
ruanhui commented on HBASE-29217:
---------------------------------
Thanks for your reply [~liangxs]
T think introducing RowNonExistsFilter is a good idea. But I'm not sure how you
plan to implement the relevant logic in the RowNonExistsFilter, because from
your analysis above, it seems unlikely that we can implement the relevant
functions without changing the server. Would you mind showing your idea in a
new PR? No need to polish, a rough POC will be fine. I think there is no need
to file another issue but I'm totally fine with that if you want to do. :)
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)