[
https://issues.apache.org/jira/browse/HBASE-26742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17493210#comment-17493210
]
Bryan Beaudreault commented on HBASE-26742:
-------------------------------------------
Does it make sense to expand the "Affect versions" here? I believe this is a
bug dating back to the 1.x releases:
[https://github.com/apache/hbase/blob/branch-1/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java#L3917.]
Not saying we necessarily have to backport this to 1.x, but I do think it's
worth documenting for those upgrading from basically any 1.x/2.x version
> Comparator of NOT_EQUAL NULL is invalid for checkAndMutate
> ----------------------------------------------------------
>
> Key: HBASE-26742
> URL: https://issues.apache.org/jira/browse/HBASE-26742
> Project: HBase
> Issue Type: Bug
> Affects Versions: 3.0.0-alpha-2, 2.4.9
> Reporter: Xiaolin Ha
> Assignee: Xiaolin Ha
> Priority: Major
> Fix For: 2.5.0, 3.0.0-alpha-3, 2.4.10
>
>
> In server side, checkAndMutate ignores CompareOperator for null or empty
> comparator value, but NOT_EQUAL should be treated specially.
> The check logic in HRegion#checkAndMutateInternal is as follows,
> {code:java}
> boolean valueIsNull =
> comparator.getValue() == null || comparator.getValue().length == 0;
> if (result.isEmpty() && valueIsNull) {
> matches = true;
> } else if (result.size() > 0 && result.get(0).getValueLength() == 0 &&
> valueIsNull) {
> matches = true;
> cellTs = result.get(0).getTimestamp();
> } else if (result.size() == 1 && !valueIsNull) {
> Cell kv = result.get(0);
> cellTs = kv.getTimestamp();
> int compareResult = PrivateCellUtil.compareValue(kv, comparator);
> matches = matches(op, compareResult);
> }{code}
> For current logics, here are some counter examples(Comparator value is set
> null),
> # result is null, operator is NOT_EQUAL, but matches is true;
> # result size >0, the value of the first cell is empty, operator is
> NOT_EQUAL, but matches is true;
> # result size is 1, operator is NOT_EQUAL, but matches is false;
--
This message was sent by Atlassian Jira
(v8.20.1#820001)