HBASE-13501 - Deprecate/Remove getComparator() in HRegionInfo. (Ram)

This commit is contained in:
ramkrishna 2015-04-23 12:12:36 +05:30
parent a4202879ad
commit bcb2a279c4
6 changed files with 25 additions and 20 deletions

View File

@ -870,7 +870,9 @@ public class HRegionInfo implements Comparable<HRegionInfo> {
/**
* @return Comparator to use comparing {@link KeyValue}s.
* @deprecated This method should not have been here. Use Region#getCellComparator()
*/
@Deprecated
public KVComparator getComparator() {
return isMetaRegion()?
KeyValue.META_COMPARATOR: KeyValue.COMPARATOR;

View File

@ -83,6 +83,7 @@ import org.apache.hadoop.hbase.HDFSBlocksDistribution;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.KeyValue.KVComparator;
import org.apache.hadoop.hbase.KeyValueUtil;
import org.apache.hadoop.hbase.NamespaceDescriptor;
import org.apache.hadoop.hbase.NotServingRegionException;
@ -289,7 +290,6 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
private final HRegionFileSystem fs;
protected final Configuration conf;
private final Configuration baseConf;
private final KeyValue.KVComparator comparator;
private final int rowLockWaitDuration;
static final int DEFAULT_ROWLOCK_WAIT_DURATION = 30000;
@ -638,7 +638,6 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
throw new IllegalArgumentException("Need original base configuration");
}
this.comparator = fs.getRegionInfo().getComparator();
this.wal = wal;
this.fs = fs;
@ -1643,13 +1642,6 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
return size;
}
/**
* @return KeyValue Comparator
*/
public KeyValue.KVComparator getComparator() {
return this.comparator;
}
/*
* Do preparation for pending compaction.
* @throws IOException
@ -5207,6 +5199,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
private long readPt;
private long maxResultSize;
protected HRegion region;
protected KVComparator comparator;
@Override
public HRegionInfo getRegionInfo() {
@ -5223,6 +5216,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
} else {
this.filter = null;
}
this.comparator = region.getCellCompartor();
/**
* By default, calls to next/nextRaw must enforce the batch limit. Thus, construct a default
@ -5273,9 +5267,9 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
protected void initializeKVHeap(List<KeyValueScanner> scanners,
List<KeyValueScanner> joinedScanners, HRegion region)
throws IOException {
this.storeHeap = new KeyValueHeap(scanners, region.comparator);
this.storeHeap = new KeyValueHeap(scanners, comparator);
if (!joinedScanners.isEmpty()) {
this.joinedHeap = new KeyValueHeap(joinedScanners, region.comparator);
this.joinedHeap = new KeyValueHeap(joinedScanners, comparator);
}
}
@ -7147,7 +7141,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
public static final long FIXED_OVERHEAD = ClassSize.align(
ClassSize.OBJECT +
ClassSize.ARRAY +
45 * ClassSize.REFERENCE + 2 * Bytes.SIZEOF_INT +
44 * ClassSize.REFERENCE + 2 * Bytes.SIZEOF_INT +
(14 * Bytes.SIZEOF_LONG) +
5 * Bytes.SIZEOF_BOOLEAN);
@ -7837,4 +7831,9 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
configurationManager.get().deregisterObserver(s);
}
}
@Override
public KVComparator getCellCompartor() {
return this.getRegionInfo().isMetaRegion() ? KeyValue.META_COMPARATOR : KeyValue.COMPARATOR;
}
}

View File

@ -232,7 +232,7 @@ public class HStore implements Store {
this.dataBlockEncoder =
new HFileDataBlockEncoderImpl(family.getDataBlockEncoding());
this.comparator = info.getComparator();
this.comparator = region.getCellCompartor();
// used by ScanQueryMatcher
long timeToPurgeDeletes =
Math.max(conf.getLong("hbase.hstore.time.to.purge.deletes", 0), 0);

View File

@ -27,6 +27,7 @@ import org.apache.hadoop.hbase.HBaseInterfaceAudience;
import org.apache.hadoop.hbase.HDFSBlocksDistribution;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.KeyValue.KVComparator;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.classification.InterfaceStability;
import org.apache.hadoop.hbase.client.Append;
@ -392,6 +393,9 @@ public interface Region extends ConfigurationObserver {
*/
RegionScanner getScanner(Scan scan) throws IOException;
/** The comparator to be used with the region */
KVComparator getCellCompartor();
/**
* Perform one or more increment operations on a row.
* @param increment

View File

@ -48,17 +48,17 @@ class ReversedRegionScannerImpl extends RegionScannerImpl {
@Override
protected void initializeKVHeap(List<KeyValueScanner> scanners,
List<KeyValueScanner> joinedScanners, HRegion region) throws IOException {
this.storeHeap = new ReversedKeyValueHeap(scanners, region.getComparator());
this.storeHeap = new ReversedKeyValueHeap(scanners, comparator);
if (!joinedScanners.isEmpty()) {
this.joinedHeap = new ReversedKeyValueHeap(joinedScanners,
region.getComparator());
comparator);
}
}
@Override
protected boolean isStopRow(byte[] currentRow, int offset, short length) {
return currentRow == null
|| (super.stopRow != null && region.getComparator().compareRows(
|| (super.stopRow != null && comparator.compareRows(
stopRow, 0, stopRow.length, currentRow, offset, length) >= super.isScan);
}

View File

@ -457,9 +457,9 @@ public class TestScannerHeartbeatMessages {
@Override
protected void initializeKVHeap(List<KeyValueScanner> scanners,
List<KeyValueScanner> joinedScanners, HRegion region) throws IOException {
this.storeHeap = new HeartbeatReversedKVHeap(scanners, region.getComparator());
this.storeHeap = new HeartbeatReversedKVHeap(scanners, region.getCellCompartor());
if (!joinedScanners.isEmpty()) {
this.joinedHeap = new HeartbeatReversedKVHeap(joinedScanners, region.getComparator());
this.joinedHeap = new HeartbeatReversedKVHeap(joinedScanners, region.getCellCompartor());
}
}
}
@ -485,9 +485,9 @@ public class TestScannerHeartbeatMessages {
@Override
protected void initializeKVHeap(List<KeyValueScanner> scanners,
List<KeyValueScanner> joinedScanners, HRegion region) throws IOException {
this.storeHeap = new HeartbeatKVHeap(scanners, region.getComparator());
this.storeHeap = new HeartbeatKVHeap(scanners, region.getCellCompartor());
if (!joinedScanners.isEmpty()) {
this.joinedHeap = new HeartbeatKVHeap(joinedScanners, region.getComparator());
this.joinedHeap = new HeartbeatKVHeap(joinedScanners, region.getCellCompartor());
}
}
}