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

This commit is contained in:
ramkrishna 2015-04-22 09:34:10 +05:30
parent 59cc620e85
commit 385b5fa1f6
2 changed files with 11 additions and 1 deletions

View File

@ -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.

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;