@InterfaceAudience.Private public abstract class Segment extends Object implements MemStoreSizing
Modifier and Type | Field and Description |
---|---|
private AtomicReference<CellSet> |
cellSet |
private CellComparator |
comparator |
static long |
DEEP_OVERHEAD |
static long |
FIXED_OVERHEAD |
private MemStoreLAB |
memStoreLAB |
protected MemStoreSizing |
memStoreSizing |
protected long |
minSequenceId |
protected boolean |
tagsPresent |
protected TimeRangeTracker |
timeRangeTracker |
private ReentrantReadWriteLock |
updatesLock |
DUD
Modifier | Constructor and Description |
---|---|
protected |
Segment(CellComparator comparator,
List<ImmutableSegment> segments,
TimeRangeTracker trt) |
protected |
Segment(CellComparator comparator,
TimeRangeTracker trt) |
protected |
Segment(CellSet cellSet,
CellComparator comparator,
MemStoreLAB memStoreLAB,
TimeRangeTracker trt) |
protected |
Segment(Segment segment) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closing a segment before it is being discarded
|
int |
compare(Cell left,
Cell right) |
boolean |
compareAndSetDataSize(long expected,
long updated) |
int |
compareRows(Cell left,
Cell right) |
void |
decScannerCount() |
(package private) void |
dump(org.slf4j.Logger log)
Dumps all cells of the segment into the given log
|
(package private) static int |
getCellLength(Cell cell)
Get cell length after serialized in
KeyValue |
int |
getCellsCount() |
protected CellSet |
getCellSet() |
protected CellComparator |
getComparator()
Returns the Cell comparator used by this segment
|
long |
getDataSize() |
long |
getHeapSize() |
(package private) MemStoreLAB |
getMemStoreLAB() |
MemStoreSize |
getMemStoreSize() |
long |
getMinSequenceId() |
long |
getOffHeapSize() |
protected KeyValueScanner |
getScanner(long readPoint)
Creates the scanner for the given read point
|
List<KeyValueScanner> |
getScanners(long readPoint) |
TimeRangeTracker |
getTimeRangeTracker() |
private ReentrantReadWriteLock |
getUpdatesLock() |
SortedSet<Cell> |
headSet(Cell firstKeyOnRow) |
protected long |
heapSizeChange(Cell cell,
boolean allocated) |
long |
incMemStoreSize(long delta,
long heapOverhead,
long offHeapOverhead,
int cellsCount) |
void |
incScannerCount() |
protected long |
indexEntryOffHeapSize(boolean offHeap) |
protected long |
indexEntryOnHeapSize(boolean onHeap) |
protected abstract long |
indexEntrySize() |
protected void |
internalAdd(Cell cell,
boolean mslabUsed,
MemStoreSizing memstoreSizing,
boolean sizeAddedPreOperation) |
boolean |
isEmpty() |
boolean |
isTagsPresent() |
Iterator<Cell> |
iterator() |
Cell |
last() |
Cell |
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 long |
offHeapSizeChange(Cell cell,
boolean allocated) |
protected Segment |
setCellSet(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 constructor
|
boolean |
sharedLock() |
void |
sharedUnlock() |
boolean |
shouldSeek(TimeRange tr,
long oldestUnexpiredTS) |
protected SortedSet<Cell> |
tailSet(Cell firstCell)
Returns a subset of the segment cell set, which starts with the given cell
|
String |
toString() |
protected void |
updateMetaInfo(Cell cellToAdd,
boolean succ,
boolean mslabUsed,
MemStoreSizing memstoreSizing,
boolean sizeAddedPreOperation) |
protected void |
updateMetaInfo(Cell cellToAdd,
boolean succ,
MemStoreSizing memstoreSizing) |
void |
waitForUpdates() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
decMemStoreSize, decMemStoreSize, incMemStoreSize
public static final long FIXED_OVERHEAD
public static final long DEEP_OVERHEAD
private AtomicReference<CellSet> cellSet
private final CellComparator comparator
private ReentrantReadWriteLock updatesLock
protected long minSequenceId
private MemStoreLAB memStoreLAB
protected final MemStoreSizing memStoreSizing
protected final TimeRangeTracker timeRangeTracker
protected volatile boolean tagsPresent
protected Segment(CellComparator comparator, TimeRangeTracker trt)
protected Segment(CellComparator comparator, List<ImmutableSegment> segments, TimeRangeTracker trt)
protected Segment(CellSet cellSet, CellComparator comparator, MemStoreLAB memStoreLAB, TimeRangeTracker trt)
protected KeyValueScanner getScanner(long readPoint)
public List<KeyValueScanner> getScanners(long readPoint)
public boolean isEmpty()
public void close()
public Cell maybeCloneWithAllocator(Cell cell, boolean forceCloneOfBigCell)
static int getCellLength(Cell cell)
KeyValue
public boolean shouldSeek(TimeRange tr, long oldestUnexpiredTS)
public boolean isTagsPresent()
public void incScannerCount()
public void decScannerCount()
protected Segment setCellSet(CellSet cellSetOld, CellSet cellSetNew)
public MemStoreSize getMemStoreSize()
getMemStoreSize
in interface MemStoreSizing
MemStoreSizing.getDataSize()
,
MemStoreSizing.getHeapSize()
, and MemStoreSizing.getOffHeapSize()
, in the one go.public long getDataSize()
getDataSize
in interface MemStoreSizing
public long getHeapSize()
getHeapSize
in interface MemStoreSizing
public long getOffHeapSize()
getOffHeapSize
in interface MemStoreSizing
public int getCellsCount()
getCellsCount
in interface MemStoreSizing
public long incMemStoreSize(long delta, long heapOverhead, long offHeapOverhead, int cellsCount)
incMemStoreSize
in interface MemStoreSizing
public boolean sharedLock()
public void sharedUnlock()
public void waitForUpdates()
public boolean compareAndSetDataSize(long expected, long updated)
compareAndSetDataSize
in interface MemStoreSizing
public long getMinSequenceId()
public TimeRangeTracker getTimeRangeTracker()
public int compareRows(Cell left, Cell right)
protected CellSet getCellSet()
protected CellComparator getComparator()
protected void internalAdd(Cell cell, boolean mslabUsed, MemStoreSizing memstoreSizing, boolean sizeAddedPreOperation)
protected void updateMetaInfo(Cell cellToAdd, boolean succ, boolean mslabUsed, MemStoreSizing memstoreSizing, boolean sizeAddedPreOperation)
protected void updateMetaInfo(Cell cellToAdd, boolean succ, MemStoreSizing memstoreSizing)
protected long heapSizeChange(Cell cell, boolean allocated)
protected long offHeapSizeChange(Cell cell, boolean allocated)
protected long indexEntryOnHeapSize(boolean onHeap)
protected long indexEntryOffHeapSize(boolean offHeap)
protected abstract long indexEntrySize()
protected SortedSet<Cell> tailSet(Cell firstCell)
firstCell
- a cell in the segmentMemStoreLAB getMemStoreLAB()
void dump(org.slf4j.Logger log)
private ReentrantReadWriteLock getUpdatesLock()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.