org.apache.hadoop.hbase.regionserver
Class TimeRangeTracker

java.lang.Object
  extended by org.apache.hadoop.hbase.regionserver.TimeRangeTracker
All Implemented Interfaces:
org.apache.hadoop.io.Writable

@InterfaceAudience.Private
public class TimeRangeTracker
extends Object
implements org.apache.hadoop.io.Writable

Stores minimum and maximum timestamp values. Both timestamps are inclusive. Use this class at write-time ONLY. Too much synchronization to use at read time (TODO: there are two scenarios writing, once when lots of concurrency as part of memstore updates but then later we can make one as part of a compaction when there is only one thread involved -- consider making different version, the synchronized and the unsynchronized). 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.


Constructor Summary
TimeRangeTracker()
          Default constructor.
TimeRangeTracker(long minimumTimestamp, long maximumTimestamp)
           
TimeRangeTracker(TimeRangeTracker trt)
          Copy Constructor
 
Method Summary
 long getMax()
           
 long getMin()
           
static TimeRangeTracker getTimeRangeTracker(byte[] timeRangeTrackerBytes)
           
 boolean includesTimeRange(TimeRange tr)
          Check if the range has any overlap with TimeRange
 void includeTimestamp(byte[] key)
          Update the current TimestampRange to include the timestamp from Key.
 void includeTimestamp(KeyValue kv)
          Update the current TimestampRange to include the timestamp from KeyValue If the Key is of type DeleteColumn or DeleteFamily, it includes the entire time range from 0 to timestamp of the key.
 void readFields(DataInput in)
           
 String toString()
           
 void write(DataOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TimeRangeTracker

public TimeRangeTracker()
Default constructor. Initializes TimeRange to be null


TimeRangeTracker

public TimeRangeTracker(TimeRangeTracker trt)
Copy Constructor

Parameters:
trt - source TimeRangeTracker

TimeRangeTracker

public TimeRangeTracker(long minimumTimestamp,
                        long maximumTimestamp)
Method Detail

includeTimestamp

public void includeTimestamp(KeyValue kv)
Update the current TimestampRange to include the timestamp from KeyValue If the Key is of type DeleteColumn or DeleteFamily, it includes the entire time range from 0 to timestamp of the key.

Parameters:
kv - the KeyValue to include

includeTimestamp

public void includeTimestamp(byte[] key)
Update the current TimestampRange to include the timestamp from Key. If the Key is of type DeleteColumn or DeleteFamily, it includes the entire time range from 0 to timestamp of the key.

Parameters:
key -

includesTimeRange

public boolean includesTimeRange(TimeRange tr)
Check if the range has any overlap with TimeRange

Parameters:
tr - TimeRange
Returns:
True if there is overlap, false otherwise

getMin

public long getMin()
Returns:
the minimumTimestamp

getMax

public long getMax()
Returns:
the maximumTimestamp

write

public void write(DataOutput out)
           throws IOException
Specified by:
write in interface org.apache.hadoop.io.Writable
Throws:
IOException

readFields

public void readFields(DataInput in)
                throws IOException
Specified by:
readFields in interface org.apache.hadoop.io.Writable
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object

getTimeRangeTracker

public static TimeRangeTracker getTimeRangeTracker(byte[] timeRangeTrackerBytes)
                                            throws IOException
Returns:
An instance of TimeRangeTracker filled w/ the content of serialized TimeRangeTracker in timeRangeTrackerBytes.
Throws:
IOException


Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.