[ https://issues.apache.org/jira/browse/HBASE-26742?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Xiaolin Ha resolved HBASE-26742. -------------------------------- Fix Version/s: 2.5.0 3.0.0-alpha-3 2.4.10 Resolution: Fixed Merged to branch-2.4+, thanks [~zhangduo] for reviewing. > 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-1, 2.0.0 > 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)