@InterfaceAudience.Private public class DefaultMemStore extends Object implements MemStore
Cells. 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.
| 限定符和类型 | 类和说明 |
|---|---|
protected static class |
DefaultMemStore.MemStoreScanner |
| 限定符和类型 | 字段和说明 |
|---|---|
static long |
DEEP_OVERHEAD |
static long |
FIXED_OVERHEAD |
| 构造器和说明 |
|---|
DefaultMemStore()
Default constructor.
|
DefaultMemStore(org.apache.hadoop.conf.Configuration conf,
KeyValue.KVComparator c)
Constructor.
|
| 限定符和类型 | 方法和说明 |
|---|---|
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 在接口中 MemStoreMemStoreSnapshotpublic void clearSnapshot(long id)
throws UnexpectedStateException
clearSnapshot 在接口中 MemStoreid - Id of the snapshot to clean out.UnexpectedStateExceptionsnapshot()public long getFlushableSize()
MemStoregetFlushableSize 在接口中 MemStorepublic long getSnapshotSize()
MemStoregetSnapshotSize 在接口中 MemStorepublic long add(Cell cell)
public long timeOfOldestEdit()
timeOfOldestEdit 在接口中 MemStorepublic void rollback(Cell cell)
public long delete(Cell deleteCell)
public void getRowKeyAtOrBefore(org.apache.hadoop.hbase.regionserver.GetClosestRowBeforeTracker state)
MemStoregetRowKeyAtOrBefore 在接口中 MemStorestate - column/delete tracking statepublic long updateColumnValue(byte[] row,
byte[] family,
byte[] qualifier,
long newValue,
long now)
updateColumnValue 在接口中 MemStorerow - 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 在接口中 MemStorepublic boolean shouldSeek(Scan scan, Store store, long oldestUnexpiredTS)
scan - scanstore - holds reference to cfoldestUnexpiredTS - public long heapSize()
public static void main(String[] args)
args - main argsCopyright © 2007–2021 The Apache Software Foundation. All rights reserved.