HBASE-13502 - Deprecate/remove getRowComparator() in TableName (Ram)

This commit is contained in:
ramkrishna 2015-04-22 09:24:00 +05:30
parent 07b8a7b264
commit 2396020752
2 changed files with 11 additions and 1 deletions

View File

@ -31,11 +31,13 @@ import org.apache.commons.logging.LogFactory;
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.RegionLocations;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.KeyValue.KVComparator;
/**
* A cache implementation for region locations from meta.
@ -85,7 +87,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;
}
@ -94,6 +96,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.

View File

@ -513,7 +513,11 @@ public final class TableName implements Comparable<TableName> {
* 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;