Package org.apache.cassandra.db
Class Memtable
- java.lang.Object
-
- org.apache.cassandra.db.Memtable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMemtable.LastCommitLogPositionstatic classMemtable.MemtableUnfilteredPartitionIterator
-
Field Summary
Fields Modifier and Type Field Description ColumnFamilyStorecfsClusteringComparatorinitialComparatorstatic MemtablePoolMEMORY_POOLstatic longNO_MIN_TIMESTAMP
-
Constructor Summary
Constructors Constructor Description Memtable(java.util.concurrent.atomic.AtomicReference<CommitLogPosition> commitLogLowerBound, ColumnFamilyStore cfs)Memtable(TableMetadata metadata)Memtable(TableMetadata metadata, long minTimestamp)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ThrowableabortRunnables(java.util.List<org.apache.cassandra.db.Memtable.FlushRunnable> runnables, java.lang.Throwable t)booleanaccepts(OpOrder.Group opGroup, CommitLogPosition commitLogPosition)intcompareTo(Memtable that)static MemtablePoolcreateMemtableAllocatorPoolInternal(Config.MemtableAllocationType allocationType, long heapLimit, long offHeapLimit, float cleaningThreshold, MemtableCleaner cleaner)java.util.List<org.apache.cassandra.db.Memtable.FlushRunnable>flushRunnables(LifecycleTransaction txn)MemtableAllocatorgetAllocator()CommitLogPositiongetCommitLogLowerBound()CommitLogPositiongetCommitLogUpperBound()longgetLiveDataSize()longgetMinTimestamp()Returns the minTS if one available, otherwise NO_MIN_TIMESTAMP.longgetOperations()PartitiongetPartition(DecoratedKey key)booleanisClean()booleanisExpired()booleanisLive()Memtable.MemtableUnfilteredPartitionIteratormakePartitionIterator(ColumnFilter columnFilter, DataRange dataRange)voidmakeUnflushable()For testing only.booleanmayContainDataBefore(CommitLogPosition position)intpartitionCount()voidsetDiscarding(OpOrder.Barrier writeBarrier, java.util.concurrent.atomic.AtomicReference<CommitLogPosition> commitLogUpperBound)java.lang.StringtoString()
-
-
-
Field Detail
-
MEMORY_POOL
public static final MemtablePool MEMORY_POOL
-
NO_MIN_TIMESTAMP
public static final long NO_MIN_TIMESTAMP
- See Also:
- Constant Field Values
-
cfs
public final ColumnFamilyStore cfs
-
initialComparator
public final ClusteringComparator initialComparator
-
-
Constructor Detail
-
Memtable
public Memtable(java.util.concurrent.atomic.AtomicReference<CommitLogPosition> commitLogLowerBound, ColumnFamilyStore cfs)
-
Memtable
public Memtable(TableMetadata metadata)
-
Memtable
public Memtable(TableMetadata metadata, long minTimestamp)
-
-
Method Detail
-
createMemtableAllocatorPoolInternal
public static MemtablePool createMemtableAllocatorPoolInternal(Config.MemtableAllocationType allocationType, long heapLimit, long offHeapLimit, float cleaningThreshold, MemtableCleaner cleaner)
-
compareTo
public int compareTo(Memtable that)
- Specified by:
compareToin interfacejava.lang.Comparable<Memtable>
-
getAllocator
public MemtableAllocator getAllocator()
-
getLiveDataSize
public long getLiveDataSize()
-
getOperations
public long getOperations()
-
setDiscarding
public void setDiscarding(OpOrder.Barrier writeBarrier, java.util.concurrent.atomic.AtomicReference<CommitLogPosition> commitLogUpperBound)
-
accepts
public boolean accepts(OpOrder.Group opGroup, CommitLogPosition commitLogPosition)
-
getCommitLogLowerBound
public CommitLogPosition getCommitLogLowerBound()
-
getCommitLogUpperBound
public CommitLogPosition getCommitLogUpperBound()
-
isLive
public boolean isLive()
-
isClean
public boolean isClean()
-
mayContainDataBefore
public boolean mayContainDataBefore(CommitLogPosition position)
-
isExpired
public boolean isExpired()
- Returns:
- true if this memtable is expired. Expiration time is determined by CF's memtable_flush_period_in_ms.
-
partitionCount
public int partitionCount()
-
flushRunnables
public java.util.List<org.apache.cassandra.db.Memtable.FlushRunnable> flushRunnables(LifecycleTransaction txn)
-
abortRunnables
public java.lang.Throwable abortRunnables(java.util.List<org.apache.cassandra.db.Memtable.FlushRunnable> runnables, java.lang.Throwable t)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
makePartitionIterator
public Memtable.MemtableUnfilteredPartitionIterator makePartitionIterator(ColumnFilter columnFilter, DataRange dataRange)
-
getPartition
public Partition getPartition(DecoratedKey key)
-
getMinTimestamp
public long getMinTimestamp()
Returns the minTS if one available, otherwise NO_MIN_TIMESTAMP. EncodingStats uses a synthetic epoch TS at 2015. We don't want to leak that (CASSANDRA-18118) so we return NO_MIN_TIMESTAMP instead.- Returns:
- The minTS or NO_MIN_TIMESTAMP if none available
-
makeUnflushable
public void makeUnflushable()
For testing only. Give this memtable too big a size to make it always fail flushing.
-
-