From 21594e57ef75bba28acf2e478e7bfe38aaeef0d7 Mon Sep 17 00:00:00 2001 From: Zhihong Yu Date: Mon, 17 Dec 2012 19:41:36 +0000 Subject: [PATCH] HBASE-7342 Split operation without split key incorrectly finds the middle key in off-by-one error (Aleksandr Shulman) git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1423110 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/hadoop/hbase/io/hfile/HFileBlockIndex.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileBlockIndex.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileBlockIndex.java index ab2ef657f77..893827a6b76 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileBlockIndex.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileBlockIndex.java @@ -342,7 +342,7 @@ public class HFileBlockIndex { midKey = Arrays.copyOfRange(b.array(), keyOffset, keyOffset + keyLen); } else { // The middle of the root-level index. - midKey = blockKeys[(rootCount - 1) / 2]; + midKey = blockKeys[rootCount / 2]; } this.midKey.set(midKey); @@ -1427,5 +1427,4 @@ public class HFileBlockIndex { public static int getMaxChunkSize(Configuration conf) { return conf.getInt(MAX_CHUNK_SIZE_KEY, DEFAULT_MAX_CHUNK_SIZE); } - }