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:
Comparable<Memtable>,CellSourceIdentifier,Memtable,UnfilteredSource
- Direct Known Subclasses:
AbstractAllocatorMemtable
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.StatsCollectorNested 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, statsCollectorFields inherited from interface org.apache.cassandra.db.memtable.Memtable
NO_MIN_TIMESTAMP -
Constructor Summary
ConstructorsConstructorDescriptionAbstractMemtableWithCommitlog(TableMetadataRef metadataRef, AtomicReference<CommitLogPosition> commitLogLowerBound) -
Method Summary
Modifier and TypeMethodDescriptionbooleanaccepts(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.voiddiscard()This memtable is no longer in use or required for outstanding flushes or operations.Approximate commit log lower bound, <= getCommitLogLowerBound, used as a time stamp for orderingThe commit log position at the time that this memtable was createdThe commit log position at the time that this memtable was switched outbooleanmayContainDataBefore(CommitLogPosition position) True if the memtable can contain any data that was written before the given commit log positionvoidswitchOut(OpOrder.Barrier writeBarrier, 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, updateMinMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.cassandra.db.CellSourceIdentifier
isEqualSourceMethods inherited from interface org.apache.cassandra.db.memtable.Memtable
addMemoryUsageTo, compareTo, getFlushSet, getLiveDataSize, isClean, localRangesUpdated, markExtraOffHeapUsed, markExtraOnHeapUsed, metadataUpdated, partitionCount, performSnapshot, put, shouldSwitchMethods inherited from interface org.apache.cassandra.db.rows.UnfilteredSource
partitionIterator, rowIterator, rowIterator
-
Constructor Details
-
AbstractMemtableWithCommitlog
public AbstractMemtableWithCommitlog(TableMetadataRef metadataRef, AtomicReference<CommitLogPosition> commitLogLowerBound)
-
-
Method Details
-
getApproximateCommitLogLowerBound
Description copied from interface:MemtableApproximate commit log lower bound, <= getCommitLogLowerBound, used as a time stamp for ordering -
switchOut
public void switchOut(OpOrder.Barrier writeBarrier, AtomicReference<CommitLogPosition> commitLogUpperBound) Description copied from interface:MemtableCalled 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:MemtableThis memtable is no longer in use or required for outstanding flushes or operations. All held memory must be released. -
accepts
Description copied from interface:MemtableDecide 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
Description copied from interface:MemtableThe commit log position at the time that this memtable was created -
getFinalCommitLogUpperBound
Description copied from interface:MemtableThe commit log position at the time that this memtable was switched out -
mayContainDataBefore
Description copied from interface:MemtableTrue if the memtable can contain any data that was written before the given commit log position
-