@InterfaceAudience.Private public abstract class AbstractMemStore extends Object implements MemStore
Modifier and Type | Field and Description |
---|---|
protected MutableSegment |
active |
private CellComparator |
comparator |
private org.apache.hadoop.conf.Configuration |
conf |
static long |
DEEP_OVERHEAD |
static long |
FIXED_OVERHEAD |
private static long |
NO_SNAPSHOT_ID |
protected RegionServicesForStores |
regionServices |
protected ImmutableSegment |
snapshot |
protected long |
snapshotId |
private long |
timeOfOldestEdit |
Modifier | Constructor and Description |
---|---|
protected |
AbstractMemStore(org.apache.hadoop.conf.Configuration conf,
CellComparator c,
RegionServicesForStores regionServices) |
Modifier and Type | Method and Description |
---|---|
void |
add(Cell cell,
MemStoreSizing memstoreSizing)
Write an update
|
void |
add(Iterable<Cell> cells,
MemStoreSizing memstoreSizing)
Write the updates
|
static long |
addToScanners(List<? extends Segment> segments,
long readPt,
long order,
List<KeyValueScanner> scanners) |
protected static long |
addToScanners(Segment segment,
long readPt,
long order,
List<KeyValueScanner> scanners) |
protected abstract void |
checkActiveSize()
Check whether anything need to be done based on the current active set size
|
void |
clearSnapshot(long id)
The passed snapshot was successfully persisted; it can be let go.
|
private static Cell |
deepCopyIfNeeded(Cell cell) |
protected void |
dump(org.slf4j.Logger log) |
(package private) MutableSegment |
getActive() |
protected CellComparator |
getComparator() |
protected org.apache.hadoop.conf.Configuration |
getConfiguration() |
protected Cell |
getLowest(Cell a,
Cell b) |
protected Cell |
getNextRow(Cell key,
NavigableSet<Cell> set) |
protected abstract List<Segment> |
getSegments() |
(package private) ImmutableSegment |
getSnapshot() |
MemStoreSize |
getSnapshotSize()
Return the size of the snapshot(s) if any
|
protected abstract long |
heapSize() |
private void |
internalAdd(Cell toAdd,
boolean mslabUsed,
MemStoreSizing memstoreSizing) |
protected abstract long |
keySize() |
private 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 void |
resetActive() |
private void |
setOldestEditTimeToNow() |
long |
timeOfOldestEdit() |
String |
toString() |
abstract void |
updateLowestUnflushedSequenceIdInWAL(boolean onlyIfMoreRecent)
Updates the wal with the lowest sequence id (oldest entry) that is still in memory
|
private void |
upsert(Cell cell,
long readpoint,
MemStoreSizing memstoreSizing) |
void |
upsert(Iterable<Cell> cells,
long readpoint,
MemStoreSizing memstoreSizing)
Update or insert the specified cells.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getFlushableSize, getScanners, isSloppy, preFlushSeqIDEstimation, size, snapshot, startReplayingFromWAL, stopReplayingFromWAL
private static final long NO_SNAPSHOT_ID
private final org.apache.hadoop.conf.Configuration conf
private final CellComparator comparator
protected volatile MutableSegment active
protected volatile ImmutableSegment snapshot
protected volatile long snapshotId
private volatile long timeOfOldestEdit
protected RegionServicesForStores regionServices
public static final long FIXED_OVERHEAD
public static final long DEEP_OVERHEAD
protected AbstractMemStore(org.apache.hadoop.conf.Configuration conf, CellComparator c, RegionServicesForStores regionServices)
public static long addToScanners(List<? extends Segment> segments, long readPt, long order, List<KeyValueScanner> scanners)
protected static long addToScanners(Segment segment, long readPt, long order, List<KeyValueScanner> scanners)
protected void resetActive()
public abstract void updateLowestUnflushedSequenceIdInWAL(boolean onlyIfMoreRecent)
onlyIfMoreRecent
- a flag that marks whether to update the sequence id no matter what or
only if it is greater than the previous sequence idpublic void add(Iterable<Cell> cells, MemStoreSizing memstoreSizing)
MemStore
public void add(Cell cell, MemStoreSizing memstoreSizing)
MemStore
private static Cell deepCopyIfNeeded(Cell cell)
public void upsert(Iterable<Cell> cells, long readpoint, MemStoreSizing memstoreSizing)
MemStore
For each Cell, insert into MemStore. This will atomically upsert the value for that row/family/qualifier. If a Cell did already exist, it will then be removed.
Currently the memstoreTS is kept at 0 so as each insert happens, it will be immediately visible. May want to change this so it is atomic across all KeyValues.
This is called under row lock, so Get operations will still see updates atomically. Scans will only see each KeyValue update as atomic.
public long timeOfOldestEdit()
timeOfOldestEdit
in interface MemStore
public void clearSnapshot(long id) throws UnexpectedStateException
clearSnapshot
in interface MemStore
id
- Id of the snapshot to clean out.UnexpectedStateException
MemStore.snapshot()
public MemStoreSize getSnapshotSize()
MemStore
getSnapshotSize
in interface MemStore
protected org.apache.hadoop.conf.Configuration getConfiguration()
protected void dump(org.slf4j.Logger log)
private void upsert(Cell cell, long readpoint, MemStoreSizing memstoreSizing)
protected Cell getNextRow(Cell key, NavigableSet<Cell> set)
private Cell maybeCloneWithAllocator(Cell cell, boolean forceCloneOfBigCell)
cell
- the cell to cloneforceCloneOfBigCell
- true only during the process of flattening to CellChunkMap.private void internalAdd(Cell toAdd, boolean mslabUsed, MemStoreSizing memstoreSizing)
private void setOldestEditTimeToNow()
protected abstract long keySize()
protected abstract long heapSize()
protected CellComparator getComparator()
MutableSegment getActive()
ImmutableSegment getSnapshot()
protected abstract void checkActiveSize()
protected abstract List<Segment> getSegments() throws IOException
IOException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.