Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.8.0, 3.0.0-alpha-2, 2.4.9
-
None
-
None
Description
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,
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); }
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;
Attachments
Issue Links
- links to