Interface MemStore
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Implementing Classes:
AbstractMemStore
,CompactingMemStore
,DefaultMemStore
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(Iterable<ExtendedCell> cells, MemStoreSizing memstoreSizing) Write the updatesvoid
add
(ExtendedCell cell, MemStoreSizing memstoreSizing) Write an updatevoid
clearSnapshot
(long id) Clears the current snapshot of the Memstore.void
close()
Close the memstore.Flush will first clear out the data in snapshot if any (It will take a second flush invocation to clear the current Cell set).getScanners
(long readPt) Return the size of the snapshot(s) if anyboolean
isSloppy()
long
This method is called before the flush is executed.size()
snapshot()
Creates a snapshot of the current memstore.default void
This message intends to inform the MemStore that next coming updates are going to be part of the replaying edits from WALdefault void
This message intends to inform the MemStore that the replaying edits from WAL are donelong
Returns Oldest timestamp of all the Cells in the MemStorevoid
upsert
(Iterable<ExtendedCell> cells, long readpoint, MemStoreSizing memstoreSizing) Update or insert the specified cells.
-
Method Details
-
snapshot
Creates a snapshot of the current memstore. Snapshot must be cleared by call toclearSnapshot(long)
.- Returns:
MemStoreSnapshot
-
clearSnapshot
Clears the current snapshot of the Memstore.- Throws:
UnexpectedStateException
- See Also:
-
getFlushableSize
Flush will first clear out the data in snapshot if any (It will take a second flush invocation to clear the current Cell set). If snapshot is empty, current Cell set will be flushed.- Returns:
- On flush, how much memory we will clear.
-
getSnapshotSize
Return the size of the snapshot(s) if any- Returns:
- size of the memstore snapshot
-
add
Write an update- Parameters:
memstoreSizing
- The delta in memstore size will be passed back via this. This will include both data size and heap overhead delta.
-
add
Write the updates- Parameters:
memstoreSizing
- The delta in memstore size will be passed back via this. This will include both data size and heap overhead delta.
-
timeOfOldestEdit
long timeOfOldestEdit()Returns Oldest timestamp of all the Cells in the MemStore -
upsert
Update or insert the specified cells.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.
- Parameters:
readpoint
- readpoint below which we can safely remove duplicate Cells.memstoreSizing
- The delta in memstore size will be passed back via this. This will include both data size and heap overhead delta.
-
getScanners
- Returns:
- scanner over the memstore. This might include scanner over the snapshot when one is present.
- Throws:
IOException
-
size
- Returns:
- Total memory occupied by this MemStore. This won't include any size occupied by the snapshot. We assume the snapshot will get cleared soon. This is not thread safe and the memstore may be changed while computing its size. It is the responsibility of the caller to make sure this doesn't happen.
-
preFlushSeqIDEstimation
long preFlushSeqIDEstimation()This method is called before the flush is executed.- Returns:
- an estimation (lower bound) of the unflushed sequence id in memstore after the flush is
executed. if memstore will be cleared returns
HConstants.NO_SEQNUM
.
-
isSloppy
boolean isSloppy() -
startReplayingFromWAL
This message intends to inform the MemStore that next coming updates are going to be part of the replaying edits from WAL -
stopReplayingFromWAL
This message intends to inform the MemStore that the replaying edits from WAL are done -
close
void close()Close the memstore.Usually this should only be called when there is nothing in the memstore, unless we are going to abort ourselves.
For normal cases, this method is only used to fix the reference counting, see HBASE-27941.
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-