Class TimeRangeTracker
java.lang.Object
org.apache.hadoop.hbase.regionserver.TimeRangeTracker
- Direct Known Subclasses:
TimeRangeTracker.NonSyncTimeRangeTracker
,TimeRangeTracker.SyncTimeRangeTracker
Stores minimum and maximum timestamp values, it is [minimumTimestamp, maximumTimestamp] in
interval notation. Use this class at write-time ONLY. Too much synchronization to use at read
time Use
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.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static enum
-
Field Summary
Modifier and TypeFieldDescription(package private) static final long
(package private) static final long
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected 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()
Returns the maximumTimestampabstract long
getMin()
Returns the minimumTimestampboolean
Check if the range has ANY overlap with TimeRange(package private) void
includeTimestamp
(long timestamp) If required, update the current TimestampRange to include timestampvoid
includeTimestamp
(ExtendedCell cell) Update the current TimestampRange to include the timestamp fromcell
.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.toString()
(package private) TimeRange
Returns Make a TimeRange from current state ofthis
.
-
Field Details
-
INITIAL_MIN_TIMESTAMP
- See Also:
-
INITIAL_MAX_TIMESTAMP
- See Also:
-
-
Constructor Details
-
TimeRangeTracker
public TimeRangeTracker()
-
-
Method Details
-
create
-
create
-
create
public static TimeRangeTracker create(TimeRangeTracker.Type type, long minimumTimestamp, long maximumTimestamp) -
setMax
-
setMin
-
compareAndSetMin
-
compareAndSetMax
-
includeTimestamp
Update the current TimestampRange to include the timestamp fromcell
. If the Key is of type DeleteColumn or DeleteFamily, it includes the entire time range from 0 to timestamp of the key.- Parameters:
cell
- the Cell to include
-
includeTimestamp
If required, update the current TimestampRange to include timestamp- Parameters:
timestamp
- the timestamp value to include
-
includesTimeRange
Check if the range has ANY overlap with TimeRange- Parameters:
tr
- TimeRange, it expects [minStamp, maxStamp)- Returns:
- True if there is overlap, false otherwise
-
getMin
Returns the minimumTimestamp -
getMax
Returns the maximumTimestamp -
toString
-
parseFrom
- Parameters:
data
- the serialization data. It can't be null!- Returns:
- An instance of NonSyncTimeRangeTracker filled w/ the content of serialized
NonSyncTimeRangeTracker in
timeRangeTrackerBytes
. - Throws:
IOException
-
parseFrom
public static TimeRangeTracker parseFrom(byte[] data, TimeRangeTracker.Type type) throws IOException - Throws:
IOException
-
toByteArray
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. So we need to revert the change of serializing TimeRangeTracker back to DataOutput. For more information, please check HBASE-21012.- Parameters:
tracker
- TimeRangeTracker needed to be serialized.- Returns:
- byte array filled with serialized TimeRangeTracker.
- Throws:
IOException
- if something goes wrong in writeLong.
-
toTimeRange
Returns Make a TimeRange from current state ofthis
.
-