@InterfaceAudience.Private public abstract class TimeRangeTracker extends Object
TimeRange
at read time instead of this. See toTimeRange() to make TimeRange to use.
MemStores use this class to track minimum and maximum timestamps. The TimeRangeTracker made by
the MemStore is passed to the StoreFile for it to write out as part a flush in the the file
metadata. If no memstore involved -- i.e. a compaction -- then the StoreFile will calculate its
own TimeRangeTracker as it appends. The StoreFile serialized TimeRangeTracker is used
at read time via an instance of TimeRange
to test if Cells fit the StoreFile TimeRange.Modifier and Type | Class and Description |
---|---|
static class |
TimeRangeTracker.NonSyncTimeRangeTracker |
static class |
TimeRangeTracker.SyncTimeRangeTracker |
static class |
TimeRangeTracker.Type |
Modifier and Type | Field and Description |
---|---|
(package private) static long |
INITIAL_MAX_TIMESTAMP |
(package private) static long |
INITIAL_MIN_TIMESTAMP |
Constructor and Description |
---|
TimeRangeTracker() |
Modifier and Type | Method and Description |
---|---|
protected abstract boolean |
compareAndSetMax(long expect,
long update) |
protected abstract boolean |
compareAndSetMin(long expect,
long update) |
static TimeRangeTracker |
create(TimeRangeTracker.Type type) |
static TimeRangeTracker |
create(TimeRangeTracker.Type type,
long minimumTimestamp,
long maximumTimestamp) |
static TimeRangeTracker |
create(TimeRangeTracker.Type type,
TimeRangeTracker trt) |
abstract long |
getMax() |
abstract long |
getMin() |
boolean |
includesTimeRange(TimeRange tr)
Check if the range has ANY overlap with TimeRange
|
void |
includeTimestamp(Cell cell)
Update the current TimestampRange to include the timestamp from
cell . |
(package private) void |
includeTimestamp(long timestamp)
If required, update the current TimestampRange to include timestamp
|
static TimeRangeTracker |
parseFrom(byte[] data) |
static TimeRangeTracker |
parseFrom(byte[] data,
TimeRangeTracker.Type type) |
protected abstract void |
setMax(long ts) |
protected abstract void |
setMin(long ts) |
static byte[] |
toByteArray(TimeRangeTracker tracker)
This method used to serialize TimeRangeTracker (TRT) by protobuf while this breaks the
forward compatibility on HFile.(See HBASE-21008) In previous hbase version ( < 2.0.0 ) we use
DataOutput to serialize TRT, these old versions don't have capability to deserialize TRT
which is serialized by protobuf.
|
String |
toString() |
(package private) TimeRange |
toTimeRange() |
static final long INITIAL_MIN_TIMESTAMP
static final long INITIAL_MAX_TIMESTAMP
public TimeRangeTracker()
public static TimeRangeTracker create(TimeRangeTracker.Type type)
public static TimeRangeTracker create(TimeRangeTracker.Type type, TimeRangeTracker trt)
public static TimeRangeTracker create(TimeRangeTracker.Type type, long minimumTimestamp, long maximumTimestamp)
protected abstract void setMax(long ts)
protected abstract void setMin(long ts)
protected abstract boolean compareAndSetMin(long expect, long update)
protected abstract boolean compareAndSetMax(long expect, long update)
public void includeTimestamp(Cell cell)
cell
.
If the Key is of type DeleteColumn or DeleteFamily, it includes the
entire time range from 0 to timestamp of the key.cell
- the Cell to includevoid includeTimestamp(long timestamp)
timestamp
- the timestamp value to includepublic boolean includesTimeRange(TimeRange tr)
tr
- TimeRange, it expects [minStamp, maxStamp)public abstract long getMin()
public abstract long getMax()
public static TimeRangeTracker parseFrom(byte[] data) throws IOException
data
- the serialization data. It can't be null!timeRangeTrackerBytes
.IOException
public static TimeRangeTracker parseFrom(byte[] data, TimeRangeTracker.Type type) throws IOException
IOException
public static byte[] toByteArray(TimeRangeTracker tracker) throws IOException
tracker
- TimeRangeTracker needed to be serialized.IOException
- if something goes wrong in writeLong.TimeRange toTimeRange()
this
.Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.