public interface Memtable extends java.lang.Comparable<Memtable>, UnfilteredSource
Modifier and Type | Interface and Description |
---|---|
static interface |
Memtable.Factory
Factory interface for constructing memtables, and querying write durability features.
|
static interface |
Memtable.FlushablePartitionSet<P extends Partition>
A collection of partitions for flushing plus some information required for writing an sstable.
|
static class |
Memtable.LastCommitLogPosition
Special commit log position marker used in the upper bound marker setting process
(see
ColumnFamilyStore.setCommitLogUpperBound(java.util.concurrent.atomic.AtomicReference<org.apache.cassandra.db.commitlog.CommitLogPosition>) and accepts(org.apache.cassandra.utils.concurrent.OpOrder.Group, org.apache.cassandra.db.commitlog.CommitLogPosition) ) |
static class |
Memtable.MemoryUsage |
static interface |
Memtable.Owner
Interface for providing signals back and requesting information from the owner, i.e.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accepts(OpOrder.Group opGroup,
CommitLogPosition commitLogPosition)
Decide if this memtable should take a write with the given parameters, or if the write should go to the next
memtable.
|
void |
addMemoryUsageTo(Memtable.MemoryUsage usage)
Add this memtable's used memory to the given usage object.
|
default int |
compareTo(Memtable that)
Order memtables by time as reflected in the commit log position at time of construction
|
void |
discard()
This memtable is no longer in use or required for outstanding flushes or operations.
|
CommitLogPosition |
getApproximateCommitLogLowerBound()
Approximate commit log lower bound, <= getCommitLogLowerBound, used as a time stamp for ordering
|
CommitLogPosition |
getCommitLogLowerBound()
The commit log position at the time that this memtable was created
|
Memtable.LastCommitLogPosition |
getFinalCommitLogUpperBound()
The commit log position at the time that this memtable was switched out
|
Memtable.FlushablePartitionSet<?> |
getFlushSet(PartitionPosition from,
PartitionPosition to)
Get the collection of data between the given partition boundaries in a form suitable for flushing.
|
long |
getLiveDataSize()
Size of the data not accounting for any metadata / mapping overheads
|
static Memtable.MemoryUsage |
getMemoryUsage(Memtable memtable)
Shorthand for the getting a given table's memory usage.
|
boolean |
isClean()
True if the memtable contains no data
|
void |
localRangesUpdated()
Called when the known ranges have been updated and owner.localRangeSplits() may return different values.
|
void |
markExtraOffHeapUsed(long additionalSpace,
OpOrder.Group opGroup)
Adjust the used off-heap space by the given size (e.g.
|
void |
markExtraOnHeapUsed(long additionalSpace,
OpOrder.Group opGroup)
Adjust the used on-heap space by the given size (e.g.
|
boolean |
mayContainDataBefore(CommitLogPosition position)
True if the memtable can contain any data that was written before the given commit log position
|
TableMetadata |
metadata()
The table's definition metadata.
|
void |
metadataUpdated()
Called when the table's metadata is updated.
|
static Memtable.MemoryUsage |
newMemoryUsage()
Creates a holder for memory usage collection.
|
long |
operationCount()
Number of "operations" (in the sense defined in
PartitionUpdate.operationCount() ) the memtable has
executed. |
long |
partitionCount()
Number of partitions stored in the memtable
|
void |
performSnapshot(java.lang.String snapshotName)
If the memtable needs to do some special action for snapshots (e.g.
|
long |
put(PartitionUpdate update,
UpdateTransaction indexer,
OpOrder.Group opGroup)
Put new data in the memtable.
|
boolean |
shouldSwitch(ColumnFamilyStore.FlushReason reason)
Decides whether the memtable should be switched/flushed for the passed reason.
|
void |
switchOut(OpOrder.Barrier writeBarrier,
java.util.concurrent.atomic.AtomicReference<CommitLogPosition> commitLogUpperBound)
Called to tell the memtable that it is being switched out and will be flushed (or dropped) and discarded.
|
getMinLocalDeletionTime, getMinTimestamp, partitionIterator, rowIterator, rowIterator
long put(PartitionUpdate update, UpdateTransaction indexer, OpOrder.Group opGroup)
update
- the partition update, may be a new partition or an update to an existing oneindexer
- receives information about the update's effectopGroup
- write operation group, used to permit the operation to complete if it is needed to complete a
flush to free space.update
. See CASSANDRA-7979.long partitionCount()
long getLiveDataSize()
long operationCount()
PartitionUpdate.operationCount()
) the memtable has
executed.TableMetadata metadata()
void addMemoryUsageTo(Memtable.MemoryUsage usage)
static Memtable.MemoryUsage newMemoryUsage()
static Memtable.MemoryUsage getMemoryUsage(Memtable memtable)
void markExtraOnHeapUsed(long additionalSpace, OpOrder.Group opGroup)
additionalSpace
- the number of allocated bytesopGroup
- write operation group, used to permit the operation to complete if it is needed to complete a
flush to free space.void markExtraOffHeapUsed(long additionalSpace, OpOrder.Group opGroup)
additionalSpace
- the number of allocated bytesopGroup
- write operation group, used to permit the operation to complete if it is needed to complete a
flush to free space.Memtable.FlushablePartitionSet<?> getFlushSet(PartitionPosition from, PartitionPosition to)
void switchOut(OpOrder.Barrier writeBarrier, java.util.concurrent.atomic.AtomicReference<CommitLogPosition> commitLogUpperBound)
getFlushSet(org.apache.cassandra.db.PartitionPosition, org.apache.cassandra.db.PartitionPosition)
call (if the table is not truncated or dropped), and a
discard()
.writeBarrier
- The barrier that will signal that all writes to this memtable have completed. That is, the
point after which writes cannot be accepted by this memtable (it is permitted for writes
before this barrier to go into the next; see accepts(org.apache.cassandra.utils.concurrent.OpOrder.Group, org.apache.cassandra.db.commitlog.CommitLogPosition)
).commitLogUpperBound
- The upper commit log position for this memtable. The value may be modified after this
call and will match the next memtable's lower commit log bound.void discard()
boolean accepts(OpOrder.Group opGroup, CommitLogPosition commitLogPosition)
switchOut(org.apache.cassandra.utils.concurrent.OpOrder.Barrier, java.util.concurrent.atomic.AtomicReference<org.apache.cassandra.db.commitlog.CommitLogPosition>)
can be accepted, and
is also used to define a shared commit log bound as the upper for this memtable and lower for the next.CommitLogPosition getApproximateCommitLogLowerBound()
CommitLogPosition getCommitLogLowerBound()
Memtable.LastCommitLogPosition getFinalCommitLogUpperBound()
boolean mayContainDataBefore(CommitLogPosition position)
boolean isClean()
default int compareTo(Memtable that)
compareTo
in interface java.lang.Comparable<Memtable>
boolean shouldSwitch(ColumnFamilyStore.FlushReason reason)
void metadataUpdated()
void localRangesUpdated()
void performSnapshot(java.lang.String snapshotName)
Copyright © 2009-2022 The Apache Software Foundation