@InterfaceAudience.Private public class MemStore extends Object implements HeapSize
KeyValue
s. When asked to flush, current memstore is moved
to snapshot and is cleared. We continue to serve edits out of new memstore
and backing snapshot until flusher reports in that the flush succeeded. At
this point we let the snapshot go.
The MemStore functions should not be called in parallel. Callers should hold
write and read locks. This is done in HStore
.
Modifier and Type | Class and Description |
---|---|
protected class |
MemStore.MemStoreScanner |
Modifier and Type | Field and Description |
---|---|
static long |
DEEP_OVERHEAD |
static long |
FIXED_OVERHEAD |
Constructor and Description |
---|
MemStore()
Default constructor.
|
MemStore(org.apache.hadoop.conf.Configuration conf,
KeyValue.KVComparator c)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
TimeRangeTracker |
getSnapshotTimeRangeTracker() |
long |
heapSize()
Get the entire heap usage for this MemStore not including keys in the
snapshot.
|
long |
keySize()
Get the heap usage of KVs in this MemStore.
|
static void |
main(String[] args)
Code to help figure if our approximation of object heap sizes is close
enough.
|
boolean |
shouldSeek(Scan scan,
long oldestUnexpiredTS)
Check if this memstore may contain the required keys
|
long |
upsert(Iterable<Cell> cells,
long readpoint)
Update or insert the specified KeyValues.
|
public static final long FIXED_OVERHEAD
public static final long DEEP_OVERHEAD
public MemStore()
public MemStore(org.apache.hadoop.conf.Configuration conf, KeyValue.KVComparator c)
c
- Comparatorpublic long upsert(Iterable<Cell> cells, long readpoint)
For each KeyValue, insert into MemStore. This will atomically upsert the value for that row/family/qualifier. If a KeyValue 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.
cells
- readpoint
- readpoint below which we can safely remove duplicate KVspublic boolean shouldSeek(Scan scan, long oldestUnexpiredTS)
scan
- public TimeRangeTracker getSnapshotTimeRangeTracker()
public long heapSize()
public long keySize()
public static void main(String[] args)
args
- main argsCopyright © 2014 The Apache Software Foundation. All rights reserved.