diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetaCache.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetaCache.java index 0f59b8a0e2a..8daaac9b138 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetaCache.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetaCache.java @@ -31,6 +31,8 @@ import org.apache.hadoop.hbase.classification.InterfaceAudience; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HRegionLocation; +import org.apache.hadoop.hbase.KeyValue; +import org.apache.hadoop.hbase.KeyValue.KVComparator; import org.apache.hadoop.hbase.RegionLocations; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableName; @@ -84,7 +86,7 @@ public class MetaCache { // checking is actually the last region in the table. byte[] endKey = possibleRegion.getRegionLocation().getRegionInfo().getEndKey(); if (Bytes.equals(endKey, HConstants.EMPTY_END_ROW) || - tableName.getRowComparator().compareRows( + getRowComparator(tableName).compareRows( endKey, 0, endKey.length, row, 0, row.length) > 0) { return possibleRegion; } @@ -93,6 +95,10 @@ public class MetaCache { return null; } + private KVComparator getRowComparator(TableName tableName) { + return TableName.META_TABLE_NAME.equals(tableName) ? KeyValue.META_COMPARATOR + : KeyValue.COMPARATOR; + } /** * Put a newly discovered HRegionLocation into the cache. * @param tableName The table name. diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/TableName.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/TableName.java index 34c8155b93a..55254a9dfdd 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/TableName.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/TableName.java @@ -513,7 +513,11 @@ public final class TableName implements Comparable { * Get the appropriate row comparator for this table. * * @return The comparator. + * @deprecated The comparator is an internal property of the table. Should + * not have been exposed here */ + @InterfaceAudience.Private + @Deprecated public KVComparator getRowComparator() { if(TableName.META_TABLE_NAME.equals(this)) { return KeyValue.META_COMPARATOR;