Package org.apache.cassandra.db.memtable
Class AbstractMemtableWithCommitlog
- java.lang.Object
-
- org.apache.cassandra.db.memtable.AbstractMemtable
-
- org.apache.cassandra.db.memtable.AbstractMemtableWithCommitlog
-
- All Implemented Interfaces:
java.lang.Comparable<Memtable>
,Memtable
,UnfilteredSource
- Direct Known Subclasses:
AbstractAllocatorMemtable
public abstract class AbstractMemtableWithCommitlog extends AbstractMemtable
Memtable that uses a commit log for persistence. Provides methods of tracking the commit log positions covered by it and safely switching between memtables.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.cassandra.db.memtable.AbstractMemtable
AbstractMemtable.AbstractFlushablePartitionSet<P extends Partition>, AbstractMemtable.ColumnsCollector, AbstractMemtable.StatsCollector
-
Nested classes/interfaces inherited from interface org.apache.cassandra.db.memtable.Memtable
Memtable.Factory, Memtable.FlushablePartitionSet<P extends Partition>, Memtable.LastCommitLogPosition, Memtable.MemoryUsage, Memtable.Owner
-
-
Field Summary
-
Fields inherited from class org.apache.cassandra.db.memtable.AbstractMemtable
columnsCollector, currentOperations, metadata, minLocalDeletionTime, minTimestamp, statsCollector
-
Fields inherited from interface org.apache.cassandra.db.memtable.Memtable
NO_MIN_TIMESTAMP
-
-
Constructor Summary
Constructors Constructor Description AbstractMemtableWithCommitlog(TableMetadataRef metadataRef, java.util.concurrent.atomic.AtomicReference<CommitLogPosition> commitLogLowerBound)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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
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 orderingCommitLogPosition
getCommitLogLowerBound()
The commit log position at the time that this memtable was createdMemtable.LastCommitLogPosition
getFinalCommitLogUpperBound()
The commit log position at the time that this memtable was switched outboolean
mayContainDataBefore(CommitLogPosition position)
True if the memtable can contain any data that was written before the given commit log positionvoid
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.-
Methods inherited from class org.apache.cassandra.db.memtable.AbstractMemtable
getFlushTransaction, getMinLocalDeletionTime, getMinTimestamp, metadata, operationCount, setFlushTransaction, updateMin, updateMin
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.cassandra.db.memtable.Memtable
addMemoryUsageTo, compareTo, getFlushSet, getLiveDataSize, isClean, localRangesUpdated, markExtraOffHeapUsed, markExtraOnHeapUsed, metadataUpdated, partitionCount, performSnapshot, put, shouldSwitch
-
Methods inherited from interface org.apache.cassandra.db.rows.UnfilteredSource
partitionIterator, rowIterator, rowIterator
-
-
-
-
Constructor Detail
-
AbstractMemtableWithCommitlog
public AbstractMemtableWithCommitlog(TableMetadataRef metadataRef, java.util.concurrent.atomic.AtomicReference<CommitLogPosition> commitLogLowerBound)
-
-
Method Detail
-
getApproximateCommitLogLowerBound
public CommitLogPosition getApproximateCommitLogLowerBound()
Description copied from interface:Memtable
Approximate commit log lower bound, <= getCommitLogLowerBound, used as a time stamp for ordering
-
switchOut
public void switchOut(OpOrder.Barrier writeBarrier, java.util.concurrent.atomic.AtomicReference<CommitLogPosition> commitLogUpperBound)
Description copied from interface:Memtable
Called to tell the memtable that it is being switched out and will be flushed (or dropped) and discarded. Will be followed by aMemtable.getFlushSet(org.apache.cassandra.db.PartitionPosition, org.apache.cassandra.db.PartitionPosition)
call (if the table is not truncated or dropped), and aMemtable.discard()
.- Parameters:
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; seeMemtable.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.
-
discard
public void discard()
Description copied from interface:Memtable
This memtable is no longer in use or required for outstanding flushes or operations. All held memory must be released.
-
accepts
public boolean accepts(OpOrder.Group opGroup, CommitLogPosition commitLogPosition)
Description copied from interface:Memtable
Decide if this memtable should take a write with the given parameters, or if the write should go to the next memtable. This enforces that no writes after the barrier set byMemtable.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.
-
getCommitLogLowerBound
public CommitLogPosition getCommitLogLowerBound()
Description copied from interface:Memtable
The commit log position at the time that this memtable was created
-
getFinalCommitLogUpperBound
public Memtable.LastCommitLogPosition getFinalCommitLogUpperBound()
Description copied from interface:Memtable
The commit log position at the time that this memtable was switched out
-
mayContainDataBefore
public boolean mayContainDataBefore(CommitLogPosition position)
Description copied from interface:Memtable
True if the memtable can contain any data that was written before the given commit log position
-
-