HBASE-13501 - Deprecate/Remove getComparator() in HRegionInfo. (Ram)
This commit is contained in:
parent
a4202879ad
commit
bcb2a279c4
|
@ -870,7 +870,9 @@ public class HRegionInfo implements Comparable<HRegionInfo> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Comparator to use comparing {@link KeyValue}s.
|
* @return Comparator to use comparing {@link KeyValue}s.
|
||||||
|
* @deprecated This method should not have been here. Use Region#getCellComparator()
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public KVComparator getComparator() {
|
public KVComparator getComparator() {
|
||||||
return isMetaRegion()?
|
return isMetaRegion()?
|
||||||
KeyValue.META_COMPARATOR: KeyValue.COMPARATOR;
|
KeyValue.META_COMPARATOR: KeyValue.COMPARATOR;
|
||||||
|
|
|
@ -83,6 +83,7 @@ import org.apache.hadoop.hbase.HDFSBlocksDistribution;
|
||||||
import org.apache.hadoop.hbase.HRegionInfo;
|
import org.apache.hadoop.hbase.HRegionInfo;
|
||||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||||
import org.apache.hadoop.hbase.KeyValue;
|
import org.apache.hadoop.hbase.KeyValue;
|
||||||
|
import org.apache.hadoop.hbase.KeyValue.KVComparator;
|
||||||
import org.apache.hadoop.hbase.KeyValueUtil;
|
import org.apache.hadoop.hbase.KeyValueUtil;
|
||||||
import org.apache.hadoop.hbase.NamespaceDescriptor;
|
import org.apache.hadoop.hbase.NamespaceDescriptor;
|
||||||
import org.apache.hadoop.hbase.NotServingRegionException;
|
import org.apache.hadoop.hbase.NotServingRegionException;
|
||||||
|
@ -289,7 +290,6 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
|
||||||
private final HRegionFileSystem fs;
|
private final HRegionFileSystem fs;
|
||||||
protected final Configuration conf;
|
protected final Configuration conf;
|
||||||
private final Configuration baseConf;
|
private final Configuration baseConf;
|
||||||
private final KeyValue.KVComparator comparator;
|
|
||||||
private final int rowLockWaitDuration;
|
private final int rowLockWaitDuration;
|
||||||
static final int DEFAULT_ROWLOCK_WAIT_DURATION = 30000;
|
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");
|
throw new IllegalArgumentException("Need original base configuration");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.comparator = fs.getRegionInfo().getComparator();
|
|
||||||
this.wal = wal;
|
this.wal = wal;
|
||||||
this.fs = fs;
|
this.fs = fs;
|
||||||
|
|
||||||
|
@ -1643,13 +1642,6 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return KeyValue Comparator
|
|
||||||
*/
|
|
||||||
public KeyValue.KVComparator getComparator() {
|
|
||||||
return this.comparator;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Do preparation for pending compaction.
|
* Do preparation for pending compaction.
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
|
@ -5207,6 +5199,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
|
||||||
private long readPt;
|
private long readPt;
|
||||||
private long maxResultSize;
|
private long maxResultSize;
|
||||||
protected HRegion region;
|
protected HRegion region;
|
||||||
|
protected KVComparator comparator;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HRegionInfo getRegionInfo() {
|
public HRegionInfo getRegionInfo() {
|
||||||
|
@ -5223,6 +5216,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
|
||||||
} else {
|
} else {
|
||||||
this.filter = null;
|
this.filter = null;
|
||||||
}
|
}
|
||||||
|
this.comparator = region.getCellCompartor();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* By default, calls to next/nextRaw must enforce the batch limit. Thus, construct a default
|
* 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,
|
protected void initializeKVHeap(List<KeyValueScanner> scanners,
|
||||||
List<KeyValueScanner> joinedScanners, HRegion region)
|
List<KeyValueScanner> joinedScanners, HRegion region)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
this.storeHeap = new KeyValueHeap(scanners, region.comparator);
|
this.storeHeap = new KeyValueHeap(scanners, comparator);
|
||||||
if (!joinedScanners.isEmpty()) {
|
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(
|
public static final long FIXED_OVERHEAD = ClassSize.align(
|
||||||
ClassSize.OBJECT +
|
ClassSize.OBJECT +
|
||||||
ClassSize.ARRAY +
|
ClassSize.ARRAY +
|
||||||
45 * ClassSize.REFERENCE + 2 * Bytes.SIZEOF_INT +
|
44 * ClassSize.REFERENCE + 2 * Bytes.SIZEOF_INT +
|
||||||
(14 * Bytes.SIZEOF_LONG) +
|
(14 * Bytes.SIZEOF_LONG) +
|
||||||
5 * Bytes.SIZEOF_BOOLEAN);
|
5 * Bytes.SIZEOF_BOOLEAN);
|
||||||
|
|
||||||
|
@ -7837,4 +7831,9 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
|
||||||
configurationManager.get().deregisterObserver(s);
|
configurationManager.get().deregisterObserver(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KVComparator getCellCompartor() {
|
||||||
|
return this.getRegionInfo().isMetaRegion() ? KeyValue.META_COMPARATOR : KeyValue.COMPARATOR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,7 +232,7 @@ public class HStore implements Store {
|
||||||
this.dataBlockEncoder =
|
this.dataBlockEncoder =
|
||||||
new HFileDataBlockEncoderImpl(family.getDataBlockEncoding());
|
new HFileDataBlockEncoderImpl(family.getDataBlockEncoding());
|
||||||
|
|
||||||
this.comparator = info.getComparator();
|
this.comparator = region.getCellCompartor();
|
||||||
// used by ScanQueryMatcher
|
// used by ScanQueryMatcher
|
||||||
long timeToPurgeDeletes =
|
long timeToPurgeDeletes =
|
||||||
Math.max(conf.getLong("hbase.hstore.time.to.purge.deletes", 0), 0);
|
Math.max(conf.getLong("hbase.hstore.time.to.purge.deletes", 0), 0);
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.apache.hadoop.hbase.HBaseInterfaceAudience;
|
||||||
import org.apache.hadoop.hbase.HDFSBlocksDistribution;
|
import org.apache.hadoop.hbase.HDFSBlocksDistribution;
|
||||||
import org.apache.hadoop.hbase.HRegionInfo;
|
import org.apache.hadoop.hbase.HRegionInfo;
|
||||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
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.InterfaceAudience;
|
||||||
import org.apache.hadoop.hbase.classification.InterfaceStability;
|
import org.apache.hadoop.hbase.classification.InterfaceStability;
|
||||||
import org.apache.hadoop.hbase.client.Append;
|
import org.apache.hadoop.hbase.client.Append;
|
||||||
|
@ -392,6 +393,9 @@ public interface Region extends ConfigurationObserver {
|
||||||
*/
|
*/
|
||||||
RegionScanner getScanner(Scan scan) throws IOException;
|
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.
|
* Perform one or more increment operations on a row.
|
||||||
* @param increment
|
* @param increment
|
||||||
|
|
|
@ -48,17 +48,17 @@ class ReversedRegionScannerImpl extends RegionScannerImpl {
|
||||||
@Override
|
@Override
|
||||||
protected void initializeKVHeap(List<KeyValueScanner> scanners,
|
protected void initializeKVHeap(List<KeyValueScanner> scanners,
|
||||||
List<KeyValueScanner> joinedScanners, HRegion region) throws IOException {
|
List<KeyValueScanner> joinedScanners, HRegion region) throws IOException {
|
||||||
this.storeHeap = new ReversedKeyValueHeap(scanners, region.getComparator());
|
this.storeHeap = new ReversedKeyValueHeap(scanners, comparator);
|
||||||
if (!joinedScanners.isEmpty()) {
|
if (!joinedScanners.isEmpty()) {
|
||||||
this.joinedHeap = new ReversedKeyValueHeap(joinedScanners,
|
this.joinedHeap = new ReversedKeyValueHeap(joinedScanners,
|
||||||
region.getComparator());
|
comparator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isStopRow(byte[] currentRow, int offset, short length) {
|
protected boolean isStopRow(byte[] currentRow, int offset, short length) {
|
||||||
return currentRow == null
|
return currentRow == null
|
||||||
|| (super.stopRow != null && region.getComparator().compareRows(
|
|| (super.stopRow != null && comparator.compareRows(
|
||||||
stopRow, 0, stopRow.length, currentRow, offset, length) >= super.isScan);
|
stopRow, 0, stopRow.length, currentRow, offset, length) >= super.isScan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -457,9 +457,9 @@ public class TestScannerHeartbeatMessages {
|
||||||
@Override
|
@Override
|
||||||
protected void initializeKVHeap(List<KeyValueScanner> scanners,
|
protected void initializeKVHeap(List<KeyValueScanner> scanners,
|
||||||
List<KeyValueScanner> joinedScanners, HRegion region) throws IOException {
|
List<KeyValueScanner> joinedScanners, HRegion region) throws IOException {
|
||||||
this.storeHeap = new HeartbeatReversedKVHeap(scanners, region.getComparator());
|
this.storeHeap = new HeartbeatReversedKVHeap(scanners, region.getCellCompartor());
|
||||||
if (!joinedScanners.isEmpty()) {
|
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
|
@Override
|
||||||
protected void initializeKVHeap(List<KeyValueScanner> scanners,
|
protected void initializeKVHeap(List<KeyValueScanner> scanners,
|
||||||
List<KeyValueScanner> joinedScanners, HRegion region) throws IOException {
|
List<KeyValueScanner> joinedScanners, HRegion region) throws IOException {
|
||||||
this.storeHeap = new HeartbeatKVHeap(scanners, region.getComparator());
|
this.storeHeap = new HeartbeatKVHeap(scanners, region.getCellCompartor());
|
||||||
if (!joinedScanners.isEmpty()) {
|
if (!joinedScanners.isEmpty()) {
|
||||||
this.joinedHeap = new HeartbeatKVHeap(joinedScanners, region.getComparator());
|
this.joinedHeap = new HeartbeatKVHeap(joinedScanners, region.getCellCompartor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue