@InterfaceAudience.Private public class DefaultMemStore extends Object implements MemStore
Cell
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 static class |
DefaultMemStore.MemStoreScanner |
Modifier and Type | Field and Description |
---|---|
static long |
DEEP_OVERHEAD |
static long |
FIXED_OVERHEAD |
Constructor and Description |
---|
DefaultMemStore()
Default constructor.
|
DefaultMemStore(org.apache.hadoop.conf.Configuration conf,
KeyValue.KVComparator c)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
long |
add(Cell cell)
Write an update
|
long |
add(Iterable<Cell> cells)
Write the updates
|
void |
clearSnapshot(long id)
The passed snapshot was successfully persisted; it can be let go.
|
long |
delete(Cell deleteCell)
Write a delete
|
long |
getFlushableSize()
On flush, how much memory we will clear.
|
void |
getRowKeyAtOrBefore(org.apache.hadoop.hbase.regionserver.GetClosestRowBeforeTracker state)
Find the key that matches row exactly, or the one that immediately precedes it.
|
List<KeyValueScanner> |
getScanners(long readPt) |
long |
getSnapshotSize()
Return the size of the snapshot(s) if any
|
long |
heapSize()
Get the entire heap usage for this MemStore not including keys in the
snapshot.
|
static void |
main(String[] args)
Code to help figure if our approximation of object heap sizes is close
enough.
|
void |
rollback(Cell cell)
Remove n key from the memstore.
|
boolean |
shouldSeek(Scan scan,
Store store,
long oldestUnexpiredTS)
Check if this memstore may contain the required keys
|
long |
size() |
MemStoreSnapshot |
snapshot()
Creates a snapshot of the current memstore.
|
long |
timeOfOldestEdit() |
long |
updateColumnValue(byte[] row,
byte[] family,
byte[] qualifier,
long newValue,
long now)
Only used by tests.
|
long |
upsert(Iterable<Cell> cells,
long readpoint,
List<Cell> removedCells)
Update or insert the specified KeyValues.
|
public static final long FIXED_OVERHEAD
public static final long DEEP_OVERHEAD
public DefaultMemStore()
public DefaultMemStore(org.apache.hadoop.conf.Configuration conf, KeyValue.KVComparator c)
c
- Comparatorpublic MemStoreSnapshot snapshot()
clearSnapshot(long)
snapshot
in interface MemStore
MemStoreSnapshot
public void clearSnapshot(long id) throws UnexpectedStateException
clearSnapshot
in interface MemStore
id
- Id of the snapshot to clean out.UnexpectedStateException
snapshot()
public long getFlushableSize()
MemStore
getFlushableSize
in interface MemStore
public long getSnapshotSize()
MemStore
getSnapshotSize
in interface MemStore
public long add(Cell cell)
public long add(Iterable<Cell> cells)
MemStore
public long timeOfOldestEdit()
timeOfOldestEdit
in interface MemStore
public void rollback(Cell cell)
public long delete(Cell deleteCell)
public void getRowKeyAtOrBefore(org.apache.hadoop.hbase.regionserver.GetClosestRowBeforeTracker state)
MemStore
getRowKeyAtOrBefore
in interface MemStore
state
- column/delete tracking statepublic long updateColumnValue(byte[] row, byte[] family, byte[] qualifier, long newValue, long now)
updateColumnValue
in interface MemStore
row
- family
- qualifier
- newValue
- now
- public long upsert(Iterable<Cell> cells, long readpoint, List<Cell> removedCells)
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.
public List<KeyValueScanner> getScanners(long readPt)
getScanners
in interface MemStore
public boolean shouldSeek(Scan scan, Store store, long oldestUnexpiredTS)
scan
- scanstore
- holds reference to cfoldestUnexpiredTS
- public long heapSize()
public long size()
public static void main(String[] args)
args
- main argsCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.