@InterfaceAudience.Private public abstract class AbstractMemStore extends Object implements MemStore
Modifier and Type | Field and Description |
---|---|
private 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 n * @param memstoreSizing The delta in memstore size will be passed back via
this.
|
void |
add(Iterable<Cell> cells,
MemStoreSizing memstoreSizing)
Write the updates n * @param memstoreSizing The delta in memstore size will be passed back via
this.
|
static void |
addToScanners(List<? extends Segment> segments,
long readPt,
List<KeyValueScanner> scanners) |
protected static void |
addToScanners(Segment segment,
long readPt,
List<KeyValueScanner> scanners) |
void |
clearSnapshot(long id)
This method is protected under HStore write lock.
The passed snapshot was successfully persisted; it can be let go. |
private static Cell |
deepCopyIfNeeded(Cell cell) |
protected void |
doAdd(MutableSegment currentActive,
Cell cell,
MemStoreSizing memstoreSizing) |
private void |
doAddOrUpsert(Cell cell,
long readpoint,
MemStoreSizing memstoreSizing,
boolean doAdd) |
protected void |
doClearSnapShot() |
private void |
doUpsert(MutableSegment currentActive,
Cell cell,
long readpoint,
MemStoreSizing memstoreSizing) |
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()
Returns an ordered list of segments from most recent to oldest in memstore
|
(package private) ImmutableSegment |
getSnapshot() |
MemStoreSize |
getSnapshotSize()
Return the size of the snapshot(s) if any
|
protected abstract long |
heapSize() |
private void |
internalAdd(MutableSegment currentActive,
Cell toAdd,
boolean mslabUsed,
MemStoreSizing memstoreSizing) |
protected abstract long |
keySize()
Returns The total size of cells in this memstore.
|
private Cell |
maybeCloneWithAllocator(MutableSegment currentActive,
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 abstract void |
postUpdate(MutableSegment currentActive)
Issue any post update synchronization and tests
|
protected abstract boolean |
preUpdate(MutableSegment currentActive,
Cell cell,
MemStoreSizing memstoreSizing)
Issue any synchronization and test needed before applying the update
|
protected void |
resetActive() |
protected void |
resetTimeOfOldestEdit() |
private void |
setOldestEditTimeToNow() |
protected abstract boolean |
sizeAddedPreOperation() |
long |
timeOfOldestEdit()
Returns Oldest timestamp of all the Cells in the MemStore
|
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
private 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 void addToScanners(List<? extends Segment> segments, long readPt, List<KeyValueScanner> scanners)
protected static void addToScanners(Segment segment, long readPt, List<KeyValueScanner> scanners)
protected void resetActive()
protected void resetTimeOfOldestEdit()
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 void upsert(Cell cell, long readpoint, MemStoreSizing memstoreSizing)
private void doAddOrUpsert(Cell cell, long readpoint, MemStoreSizing memstoreSizing, boolean doAdd)
protected void doAdd(MutableSegment currentActive, Cell cell, MemStoreSizing memstoreSizing)
private void doUpsert(MutableSegment currentActive, Cell cell, long readpoint, MemStoreSizing memstoreSizing)
protected abstract boolean preUpdate(MutableSegment currentActive, Cell cell, MemStoreSizing memstoreSizing)
currentActive
- the segment to be updatedcell
- the cell to be addedmemstoreSizing
- object to accumulate region size changesprotected abstract void postUpdate(MutableSegment currentActive)
currentActive
- updated segmentprivate 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. n * @param readpoint readpoint below which we can safely remove duplicate Cells.
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()
protected void doClearSnapShot()
public MemStoreSize getSnapshotSize()
MemStore
getSnapshotSize
in interface MemStore
protected org.apache.hadoop.conf.Configuration getConfiguration()
protected void dump(org.slf4j.Logger log)
protected Cell getNextRow(Cell key, NavigableSet<Cell> set)
private Cell maybeCloneWithAllocator(MutableSegment currentActive, Cell cell, boolean forceCloneOfBigCell)
cell
- the cell to cloneforceCloneOfBigCell
- true only during the process of flattening to CellChunkMap.private void internalAdd(MutableSegment currentActive, Cell toAdd, boolean mslabUsed, MemStoreSizing memstoreSizing)
protected abstract boolean sizeAddedPreOperation()
private void setOldestEditTimeToNow()
protected abstract long keySize()
protected abstract long heapSize()
protected CellComparator getComparator()
MutableSegment getActive()
ImmutableSegment getSnapshot()
protected abstract List<Segment> getSegments() throws IOException
IOException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.