Class Segment
java.lang.Object
org.apache.hadoop.hbase.regionserver.Segment
- All Implemented Interfaces:
 MemStoreSizing
- Direct Known Subclasses:
 ImmutableSegment,MutableSegment
This is an abstraction of a segment maintained in a memstore, e.g., the active cell set or its
 snapshot. This abstraction facilitates the management of the compaction pipeline and the shifts
 of these segments from active set to snapshot set in the default implementation.
- 
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AtomicReference<CellSet>private final CellComparatorstatic final longstatic final longprivate MemStoreLABprotected final MemStoreSizingprotected longprotected booleanprotected final TimeRangeTrackerprivate ReentrantReadWriteLockFields inherited from interface org.apache.hadoop.hbase.regionserver.MemStoreSizing
DUD - 
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSegment(CellComparator comparator, List<ImmutableSegment> segments, TimeRangeTracker trt) protectedSegment(CellComparator comparator, TimeRangeTracker trt) protectedSegment(CellSet cellSet, CellComparator comparator, MemStoreLAB memStoreLAB, TimeRangeTracker trt) protected - 
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closing a segment before it is being discardedintbooleancompareAndSetDataSize(long expected, long updated) intcompareRows(Cell left, Cell right) void(package private) voiddump(org.slf4j.Logger log) Dumps all cells of the segment into the given log(package private) static intgetCellLength(Cell cell) Get cell length after serialized inKeyValueintprotected CellSetReturns a set of all cells in the segmentprotected CellComparatorReturns the Cell comparator used by this segmentlonglong(package private) MemStoreLABlonglongprotected KeyValueScannergetScanner(long readPoint) Creates the scanner for the given read pointgetScanners(long readPoint) private ReentrantReadWriteLockprotected longheapSizeChange(Cell cell, boolean allocated) longincMemStoreSize(long delta, long heapOverhead, long offHeapOverhead, int cellsCount) Returns The new dataSize ONLY as a conveniencevoidprotected longindexEntryOffHeapSize(boolean offHeap) protected longindexEntryOnHeapSize(boolean onHeap) protected abstract longprotected voidinternalAdd(Cell cell, boolean mslabUsed, MemStoreSizing memstoreSizing, boolean sizeAddedPreOperation) booleanisEmpty()Returns whether the segment has any cellsbooleaniterator()last()maybeCloneWithAllocator(Cell cell, boolean forceCloneOfBigCell) If the segment has a memory allocator the cell is being cloned to this space, and returned; otherwise the given cell is returned When a cell's size is too big (bigger than maxAlloc), it is not allocated on MSLAB.protected longoffHeapSizeChange(Cell cell, boolean allocated) protected SegmentsetCellSet(CellSet cellSetOld, CellSet cellSetNew) Setting the CellSet of the segment - used only for flat immutable segment for setting immutable CellSet after its creation in immutable segment constructorbooleanvoidbooleanshouldSeek(TimeRange tr, long oldestUnexpiredTS) Returns a subset of the segment cell set, which starts with the given celltoString()protected voidupdateMetaInfo(Cell cellToAdd, boolean succ, boolean mslabUsed, MemStoreSizing memstoreSizing, boolean sizeAddedPreOperation) protected voidupdateMetaInfo(Cell cellToAdd, boolean succ, MemStoreSizing memstoreSizing) voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.hadoop.hbase.regionserver.MemStoreSizing
decMemStoreSize, decMemStoreSize, incMemStoreSize 
- 
Field Details
- 
FIXED_OVERHEAD
 - 
DEEP_OVERHEAD
 - 
cellSet
 - 
comparator
 - 
updatesLock
 - 
minSequenceId
 - 
memStoreLAB
 - 
memStoreSizing
 - 
timeRangeTracker
 - 
tagsPresent
 
 - 
 - 
Constructor Details
- 
Segment
 - 
Segment
 - 
Segment
protected Segment(CellSet cellSet, CellComparator comparator, MemStoreLAB memStoreLAB, TimeRangeTracker trt)  - 
Segment
 
 - 
 - 
Method Details
- 
getScanner
Creates the scanner for the given read point- Returns:
 - a scanner for the given read point
 
 - 
getScanners
 - 
isEmpty
Returns whether the segment has any cells - 
close
Closing a segment before it is being discarded - 
maybeCloneWithAllocator
If the segment has a memory allocator the cell is being cloned to this space, and returned; otherwise the given cell is returned When a cell's size is too big (bigger than maxAlloc), it is not allocated on MSLAB. Since the process of flattening to CellChunkMap assumes that all cells are allocated on MSLAB, during this process, the input parameter forceCloneOfBigCell is set to 'true' and the cell is copied into MSLAB.- Returns:
 - either the given cell or its clone
 
 - 
getCellLength
Get cell length after serialized inKeyValue - 
shouldSeek
 - 
isTagsPresent
 - 
incScannerCount
 - 
decScannerCount
 - 
setCellSet
Setting the CellSet of the segment - used only for flat immutable segment for setting immutable CellSet after its creation in immutable segment constructor- Returns:
 - this object
 
 - 
getMemStoreSize
- Specified by:
 getMemStoreSizein interfaceMemStoreSizing- Returns:
 - Use this datastructure to return all three settings, 
MemStoreSizing.getDataSize(),MemStoreSizing.getHeapSize(), andMemStoreSizing.getOffHeapSize(), in the one go. 
 - 
getDataSize
- Specified by:
 getDataSizein interfaceMemStoreSizing
 - 
getHeapSize
- Specified by:
 getHeapSizein interfaceMemStoreSizing
 - 
getOffHeapSize
- Specified by:
 getOffHeapSizein interfaceMemStoreSizing
 - 
getCellsCount
- Specified by:
 getCellsCountin interfaceMemStoreSizing
 - 
incMemStoreSize
Description copied from interface:MemStoreSizingReturns The new dataSize ONLY as a convenience- Specified by:
 incMemStoreSizein interfaceMemStoreSizing
 - 
waitForUpdates
 - 
compareAndSetDataSize
- Specified by:
 compareAndSetDataSizein interfaceMemStoreSizing
 - 
getMinSequenceId
 - 
getTimeRangeTracker
 - 
last
 - 
iterator
 - 
headSet
 - 
compare
 - 
compareRows
 - 
getCellSet
Returns a set of all cells in the segment - 
getComparator
Returns the Cell comparator used by this segment- Returns:
 - the Cell comparator used by this segment
 
 - 
internalAdd
protected void internalAdd(Cell cell, boolean mslabUsed, MemStoreSizing memstoreSizing, boolean sizeAddedPreOperation)  - 
updateMetaInfo
protected void updateMetaInfo(Cell cellToAdd, boolean succ, boolean mslabUsed, MemStoreSizing memstoreSizing, boolean sizeAddedPreOperation)  - 
updateMetaInfo
 - 
heapSizeChange
- Returns:
 - The increase in heap size because of this cell addition. This includes this cell POJO's heap size itself and additional overhead because of addition on to CSLM.
 
 - 
offHeapSizeChange
 - 
indexEntryOnHeapSize
 - 
indexEntryOffHeapSize
 - 
indexEntrySize
 - 
tailSet
Returns a subset of the segment cell set, which starts with the given cell- Parameters:
 firstCell- a cell in the segment- Returns:
 - a subset of the segment cell set, which starts with the given cell
 
 - 
getMemStoreLAB
 - 
dump
Dumps all cells of the segment into the given log - 
toString
 - 
getUpdatesLock
 
 -