HBASE-20928 Rewrite calculation of midpoint - addemdum Signed-off-by: tedyu <yuzhih...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/19131649 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/19131649 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/19131649 Branch: refs/heads/HBASE-20749 Commit: 1913164970b17365e51662cf9cc9acacdda04fec Parents: ba5d1c1 Author: Xu Cang <xc...@salesforce.com> Authored: Tue Jul 24 11:37:21 2018 -0700 Committer: tedyu <yuzhih...@gmail.com> Committed: Wed Jul 25 10:00:58 2018 -0700 ---------------------------------------------------------------------- hbase-common/src/main/java/org/apache/hadoop/hbase/util/Bytes.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/19131649/hbase-common/src/main/java/org/apache/hadoop/hbase/util/Bytes.java ---------------------------------------------------------------------- diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/Bytes.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/Bytes.java index 12aaa67..e63c0db 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/Bytes.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/Bytes.java @@ -2068,7 +2068,7 @@ public class Bytes implements Comparable<Bytes> { int high = arr.length - 1; KeyValue.KeyOnlyKeyValue r = new KeyValue.KeyOnlyKeyValue(); while (low <= high) { - int mid = (low+high) >>> 1; + int mid = low + ((high - low) >> 1); // we have to compare in this order, because the comparator order // has special logic when the 'left side' is a special key. r.setKey(arr[mid], 0, arr[mid].length);