From 99f1580fc07f67a3840a10cf44b3522a394340c1 Mon Sep 17 00:00:00 2001 From: Sergey Soldatov Date: Thu, 11 Jan 2018 13:40:38 -0800 Subject: HBASE-19774 incorrect behavior of locateRegionInMeta --- .../org/apache/hadoop/hbase/client/ConnectionImplementation.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java index 562630f..e047c59 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java @@ -786,11 +786,13 @@ class ConnectionImplementation implements ClusterConnection, Closeable { // build the key of the meta region we should be looking for. // the extra 9's on the end are necessary to allow "exact" matches // without knowing the precise region names. - byte[] metaKey = RegionInfo.createRegionName(tableName, row, HConstants.NINES, false); + byte[] metaStartKey = RegionInfo.createRegionName(tableName, row, HConstants.NINES, false); + byte[] metaStopKey = RegionInfo.createRegionName(tableName, HConstants.EMPTY_START_ROW, "", false); Scan s = new Scan(); s.setReversed(true); - s.withStartRow(metaKey); + s.withStartRow(metaStartKey); + s.withStopRow(metaStopKey, true); s.addFamily(HConstants.CATALOG_FAMILY); if (this.useMetaReplicas) { @@ -908,7 +910,7 @@ class ConnectionImplementation implements ClusterConnection, Closeable { // Only relocate the parent region if necessary if(!(e instanceof RegionOfflineException || e instanceof NoServerForRegionException)) { - relocateRegion(TableName.META_TABLE_NAME, metaKey, replicaId); + relocateRegion(TableName.META_TABLE_NAME, metaStartKey, replicaId); } } finally { userRegionLock.unlock(); -- 2.5.4 (Apple Git-61)