public class ColumnFamilyStore extends java.lang.Object implements ColumnFamilyStoreMBean
| Modifier and Type | Class and Description |
|---|---|
static class |
ColumnFamilyStore.FlushLargestColumnFamily
Finds the largest memtable, as a percentage of *either* on- or off-heap memory limits, and immediately
queues it for flushing.
|
static class |
ColumnFamilyStore.RefViewFragment |
static class |
ColumnFamilyStore.ViewFragment |
| Modifier and Type | Field and Description |
|---|---|
Directories |
directories |
SecondaryIndexManager |
indexManager |
Keyspace |
keyspace |
MaterializedViewManager |
materializedViewManager |
CFMetaData |
metadata |
TableMetrics |
metric |
java.lang.String |
name |
IPartitioner |
partitioner |
OpOrder |
readOrdering |
long |
sampleLatencyNanos |
| Constructor and Description |
|---|
ColumnFamilyStore(Keyspace keyspace,
java.lang.String columnFamilyName,
IPartitioner partitioner,
int generation,
CFMetaData metadata,
Directories directories,
boolean loadSSTables) |
ColumnFamilyStore(Keyspace keyspace,
java.lang.String columnFamilyName,
IPartitioner partitioner,
int generation,
CFMetaData metadata,
Directories directories,
boolean loadSSTables,
boolean registerBookkeeping) |
| Modifier and Type | Method and Description |
|---|---|
void |
addSSTable(SSTableReader sstable) |
void |
addSSTables(java.util.Collection<SSTableReader> sstables) |
static java.lang.Iterable<ColumnFamilyStore> |
all() |
void |
apply(PartitionUpdate update,
SecondaryIndexManager.Updater indexer,
OpOrder.Group opGroup,
ReplayPosition replayPosition)
Insert/Update the column family for this key.
|
void |
beginLocalSampling(java.lang.String sampler,
int capacity)
begin sampling for a specific sampler with a given capacity.
|
void |
cleanupCache() |
protected static void |
clearEphemeralSnapshots(Directories directories) |
void |
clearSnapshot(java.lang.String snapshotName)
Clear all the snapshots for a given column family.
|
void |
clearUnsafe()
For testing.
|
java.lang.Iterable<ColumnFamilyStore> |
concatWithIndexes() |
boolean |
containsCachedParition(DecoratedKey key) |
static ColumnFamilyStore |
createColumnFamilyStore(Keyspace keyspace,
java.lang.String columnFamily,
boolean loadSSTables) |
static ColumnFamilyStore |
createColumnFamilyStore(Keyspace keyspace,
java.lang.String columnFamily,
IPartitioner partitioner,
CFMetaData metadata,
boolean loadSSTables) |
void |
disableAutoCompaction() |
ReplayPosition |
discardSSTables(long truncatedAt)
Discard all SSTables that were created before given timestamp.
|
void |
dumpMemtable()
Drops current memtable without flushing to disk.
|
void |
enableAutoCompaction() |
void |
enableAutoCompaction(boolean waitForFutures)
used for tests - to be able to check things after a minor compaction
|
long |
estimatedKeysForRange(Range<Token> range) |
long |
estimateKeys() |
javax.management.openmbean.CompositeData |
finishLocalSampling(java.lang.String sampler,
int count) |
void |
forceBlockingFlush() |
CompactionManager.AllSSTableOpStatus |
forceCleanup() |
com.google.common.util.concurrent.ListenableFuture<?> |
forceFlush() |
com.google.common.util.concurrent.ListenableFuture<?> |
forceFlush(ReplayPosition flushIfDirtyBefore)
Flush if there is unflushed data that was written to the CommitLog before @param flushIfDirtyBefore
(inclusive).
|
void |
forceMajorCompaction() |
void |
forceMajorCompaction(boolean splitOutput)
force a major compaction of this column family
|
int |
gcBefore(int nowInSec) |
Refs<SSTableReader> |
getAndReferenceOverlappingSSTables(SSTableSet sstableSet,
java.lang.Iterable<SSTableReader> sstables)
like getOverlappingSSTables, but acquires references before returning
|
static java.lang.Runnable |
getBackgroundCompactionTaskSubmitter() |
java.util.List<java.lang.String> |
getBuiltIndexes()
Returns a list of the names of the built column indexes for current store
|
ClockAndCount |
getCachedCounter(java.nio.ByteBuffer partitionKey,
Clustering clustering,
ColumnDefinition column,
CellPath path) |
java.lang.String |
getColumnFamilyName()
Deprecated.
|
java.lang.String |
getCompactionStrategyClass()
Gets the compaction strategy class name
|
CompactionStrategyManager |
getCompactionStrategyManager() |
ClusteringComparator |
getComparator() |
java.util.Map<java.lang.String,java.lang.String> |
getCompressionParameters()
Get the compression parameters
|
double |
getDroppableTombstoneRatio()
Get the ratio of droppable tombstones to real columns (and non-droppable tombstones)
|
long |
getExpectedCompactedFileSize(java.lang.Iterable<SSTableReader> sstables,
OperationType operation)
Calculate expected file size of SSTable after compaction.
|
java.util.Set<SSTableReader> |
getLiveSSTables() |
int |
getMaximumCompactionThreshold()
Gets the maximum number of sstables in queue before compaction kicks off
|
SSTableReader |
getMaxSizeFile(java.lang.Iterable<SSTableReader> sstables) |
int |
getMeanColumns() |
int |
getMinimumCompactionThreshold()
Gets the minimum number of sstables in queue before compaction kicks off
|
java.util.Collection<SSTableReader> |
getOverlappingSSTables(SSTableSet sstableSet,
java.lang.Iterable<SSTableReader> sstables) |
CachedPartition |
getRawCachedPartition(DecoratedKey key) |
long |
getSnapshotCreationTime(java.lang.String snapshotName) |
java.util.Map<java.lang.String,Pair<java.lang.Long,java.lang.Long>> |
getSnapshotDetails() |
Refs<SSTableReader> |
getSnapshotSSTableReader(java.lang.String tag) |
int[] |
getSSTableCountPerLevel() |
java.lang.String |
getSSTablePath(java.io.File directory) |
java.lang.String |
getSSTablePath(java.io.File directory,
SSTableFormat.Type format) |
java.lang.Iterable<SSTableReader> |
getSSTables(SSTableSet sstableSet) |
java.util.List<java.lang.String> |
getSSTablesForKey(java.lang.String key)
Returns a list of filenames that contain the given key on this node
|
java.lang.String |
getTableName() |
Tracker |
getTracker()
Package protected for access from the CompactionManager.
|
java.lang.Iterable<SSTableReader> |
getUncompactingSSTables() |
int |
getUnleveledSSTables() |
void |
init() |
void |
initCounterCache() |
void |
invalidate()
call when dropping or renaming a CF.
|
void |
invalidate(boolean expectMBean) |
void |
invalidateCachedPartition(DecoratedKey key) |
void |
invalidateCachedPartition(RowCacheKey key) |
boolean |
isAutoCompactionDisabled() |
boolean |
isEmpty() |
boolean |
isFilterFullyCoveredBy(ClusteringIndexFilter filter,
DataLimits limits,
CachedPartition cached,
int nowInSec) |
boolean |
isIndex()
true if this CFS contains secondary index data
|
boolean |
isRowCacheEnabled() |
boolean |
isValid() |
java.lang.Iterable<DecoratedKey> |
keySamples(Range<Token> range) |
void |
loadNewSSTables()
#Scan through Keyspace/ColumnFamily's data directory
determine which SSTables should be loaded and load them
|
static void |
loadNewSSTables(java.lang.String ksName,
java.lang.String cfName)
See #
StorageService.loadNewSSTables(String, String) for more info |
LifecycleTransaction |
markAllCompacting(OperationType operationType) |
void |
markObsolete(java.util.Collection<SSTableReader> sstables,
OperationType compactionType) |
void |
maybeUpdateRowCache(DecoratedKey key) |
void |
putCachedCounter(java.nio.ByteBuffer partitionKey,
Clustering clustering,
ColumnDefinition column,
CellPath path,
ClockAndCount clockAndCount) |
boolean |
rebuildOnFailedScrub(java.lang.Throwable failure)
CASSANDRA-5174 : For an index cfs we may be able to discard everything and just rebuild
the index when a scrub fails.
|
void |
rebuildSecondaryIndex(java.lang.String idxName) |
static void |
rebuildSecondaryIndex(java.lang.String ksName,
java.lang.String cfName,
java.lang.String... idxNames) |
void |
reload() |
<V> V |
runWithCompactionsDisabled(java.util.concurrent.Callable<V> callable,
boolean interruptValidation,
boolean interruptViews) |
CompactionManager.AllSSTableOpStatus |
scrub(boolean disableSnapshot,
boolean skipCorrupted,
boolean checkData) |
CompactionManager.AllSSTableOpStatus |
scrub(boolean disableSnapshot,
boolean skipCorrupted,
boolean alwaysFail,
boolean checkData) |
static void |
scrubDataDirectories(CFMetaData metadata)
Removes unnecessary files from the cf directory at startup: these include temp files, orphans, zero-length files
and compacted sstables.
|
ColumnFamilyStore.ViewFragment |
select(com.google.common.base.Function<View,java.lang.Iterable<SSTableReader>> filter) |
ColumnFamilyStore.RefViewFragment |
selectAndReference(com.google.common.base.Function<View,java.lang.Iterable<SSTableReader>> filter) |
void |
setCompactionStrategyClass(java.lang.String compactionStrategyClass)
Sets the compaction strategy by class name
|
void |
setCompactionThresholds(int minThreshold,
int maxThreshold)
Sets the maximum and maximum number of SSTables in queue before compaction kicks off
|
void |
setCompressionParameters(java.util.Map<java.lang.String,java.lang.String> opts)
Set the compression parameters
|
void |
setCrcCheckChance(double crcCheckChance)
Set new crc check chance
|
void |
setMaximumCompactionThreshold(int maxCompactionThreshold)
Sets the maximum number of sstables in queue before compaction kicks off
|
void |
setMinimumCompactionThreshold(int minCompactionThreshold)
Sets the minimum number of sstables in queue before compaction kicks off
|
static void |
shutdownPostFlushExecutor() |
java.util.Set<SSTableReader> |
snapshot(java.lang.String snapshotName)
Take a snap shot of this columnfamily store.
|
java.util.Set<SSTableReader> |
snapshot(java.lang.String snapshotName,
com.google.common.base.Predicate<SSTableReader> predicate,
boolean ephemeral) |
boolean |
snapshotExists(java.lang.String snapshotName) |
void |
snapshotWithoutFlush(java.lang.String snapshotName) |
java.util.Set<SSTableReader> |
snapshotWithoutFlush(java.lang.String snapshotName,
com.google.common.base.Predicate<SSTableReader> predicate,
boolean ephemeral) |
CompactionManager.AllSSTableOpStatus |
sstablesRewrite(boolean excludeCurrentVersion) |
com.google.common.util.concurrent.ListenableFuture<?> |
switchMemtable() |
java.util.concurrent.Future<?> |
switchMemtableIfCurrent(Memtable memtable)
Switches the memtable iff the live memtable is the one provided
|
java.lang.String |
toString() |
long |
trueSnapshotsSize() |
void |
truncateBlocking()
Truncate deletes the entire column family's data with no expensive tombstone creation
|
CompactionManager.AllSSTableOpStatus |
verify(boolean extendedVerify) |
public final Keyspace keyspace
public final java.lang.String name
public final CFMetaData metadata
public final IPartitioner partitioner
public final OpOrder readOrdering
public final SecondaryIndexManager indexManager
public final MaterializedViewManager materializedViewManager
public final Directories directories
public final TableMetrics metric
public volatile long sampleLatencyNanos
public ColumnFamilyStore(Keyspace keyspace, java.lang.String columnFamilyName, IPartitioner partitioner, int generation, CFMetaData metadata, Directories directories, boolean loadSSTables)
public ColumnFamilyStore(Keyspace keyspace, java.lang.String columnFamilyName, IPartitioner partitioner, int generation, CFMetaData metadata, Directories directories, boolean loadSSTables, boolean registerBookkeeping)
public static void shutdownPostFlushExecutor()
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic void reload()
public static java.lang.Runnable getBackgroundCompactionTaskSubmitter()
public void setCompactionStrategyClass(java.lang.String compactionStrategyClass)
ColumnFamilyStoreMBeansetCompactionStrategyClass in interface ColumnFamilyStoreMBeancompactionStrategyClass - the name of the compaction strategy classpublic java.lang.String getCompactionStrategyClass()
ColumnFamilyStoreMBeangetCompactionStrategyClass in interface ColumnFamilyStoreMBeanpublic java.util.Map<java.lang.String,java.lang.String> getCompressionParameters()
ColumnFamilyStoreMBeangetCompressionParameters in interface ColumnFamilyStoreMBeanpublic void setCompressionParameters(java.util.Map<java.lang.String,java.lang.String> opts)
ColumnFamilyStoreMBeansetCompressionParameters in interface ColumnFamilyStoreMBeanopts - map of string names to valuespublic void setCrcCheckChance(double crcCheckChance)
ColumnFamilyStoreMBeansetCrcCheckChance in interface ColumnFamilyStoreMBeanpublic void invalidate()
public void invalidate(boolean expectMBean)
public static ColumnFamilyStore createColumnFamilyStore(Keyspace keyspace, java.lang.String columnFamily, boolean loadSSTables)
public static ColumnFamilyStore createColumnFamilyStore(Keyspace keyspace, java.lang.String columnFamily, IPartitioner partitioner, CFMetaData metadata, boolean loadSSTables)
public static void scrubDataDirectories(CFMetaData metadata)
public void init()
public void initCounterCache()
public static void loadNewSSTables(java.lang.String ksName,
java.lang.String cfName)
StorageService.loadNewSSTables(String, String) for more infoksName - The keyspace namecfName - The columnFamily namepublic void loadNewSSTables()
loadNewSSTables in interface ColumnFamilyStoreMBeanpublic void rebuildSecondaryIndex(java.lang.String idxName)
public static void rebuildSecondaryIndex(java.lang.String ksName,
java.lang.String cfName,
java.lang.String... idxNames)
@Deprecated public java.lang.String getColumnFamilyName()
getColumnFamilyName in interface ColumnFamilyStoreMBeanpublic java.lang.String getTableName()
getTableName in interface ColumnFamilyStoreMBeanpublic java.lang.String getSSTablePath(java.io.File directory)
public java.lang.String getSSTablePath(java.io.File directory,
SSTableFormat.Type format)
public java.util.concurrent.Future<?> switchMemtableIfCurrent(Memtable memtable)
memtable - public com.google.common.util.concurrent.ListenableFuture<?> switchMemtable()
public com.google.common.util.concurrent.ListenableFuture<?> forceFlush()
public com.google.common.util.concurrent.ListenableFuture<?> forceFlush(ReplayPosition flushIfDirtyBefore)
public void forceBlockingFlush()
public void maybeUpdateRowCache(DecoratedKey key)
public void apply(PartitionUpdate update, SecondaryIndexManager.Updater indexer, OpOrder.Group opGroup, ReplayPosition replayPosition)
public java.util.Collection<SSTableReader> getOverlappingSSTables(SSTableSet sstableSet, java.lang.Iterable<SSTableReader> sstables)
sstables - public Refs<SSTableReader> getAndReferenceOverlappingSSTables(SSTableSet sstableSet, java.lang.Iterable<SSTableReader> sstables)
public void addSSTable(SSTableReader sstable)
public void addSSTables(java.util.Collection<SSTableReader> sstables)
public long getExpectedCompactedFileSize(java.lang.Iterable<SSTableReader> sstables, OperationType operation)
CLEANUP and we're not dealing with an index sstable,
then we calculate expected file size with checking token range to be eliminated.
Otherwise, we just add up all the files' size, which is the worst case file
size for compaction of all the list of files given.sstables - SSTables to calculate expected compacted file sizeoperation - Operation typepublic SSTableReader getMaxSizeFile(java.lang.Iterable<SSTableReader> sstables)
public CompactionManager.AllSSTableOpStatus forceCleanup() throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
java.util.concurrent.ExecutionExceptionjava.lang.InterruptedExceptionpublic CompactionManager.AllSSTableOpStatus scrub(boolean disableSnapshot, boolean skipCorrupted, boolean checkData) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
java.util.concurrent.ExecutionExceptionjava.lang.InterruptedExceptionpublic CompactionManager.AllSSTableOpStatus scrub(boolean disableSnapshot, boolean skipCorrupted, boolean alwaysFail, boolean checkData) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
java.util.concurrent.ExecutionExceptionjava.lang.InterruptedExceptionpublic boolean rebuildOnFailedScrub(java.lang.Throwable failure)
public CompactionManager.AllSSTableOpStatus verify(boolean extendedVerify) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
java.util.concurrent.ExecutionExceptionjava.lang.InterruptedExceptionpublic CompactionManager.AllSSTableOpStatus sstablesRewrite(boolean excludeCurrentVersion) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
java.util.concurrent.ExecutionExceptionjava.lang.InterruptedExceptionpublic void markObsolete(java.util.Collection<SSTableReader> sstables, OperationType compactionType)
public boolean isValid()
public Tracker getTracker()
public java.util.Set<SSTableReader> getLiveSSTables()
public java.lang.Iterable<SSTableReader> getSSTables(SSTableSet sstableSet)
public java.lang.Iterable<SSTableReader> getUncompactingSSTables()
public boolean isFilterFullyCoveredBy(ClusteringIndexFilter filter, DataLimits limits, CachedPartition cached, int nowInSec)
public int gcBefore(int nowInSec)
public ColumnFamilyStore.RefViewFragment selectAndReference(com.google.common.base.Function<View,java.lang.Iterable<SSTableReader>> filter)
public ColumnFamilyStore.ViewFragment select(com.google.common.base.Function<View,java.lang.Iterable<SSTableReader>> filter)
public java.util.List<java.lang.String> getSSTablesForKey(java.lang.String key)
ColumnFamilyStoreMBeangetSSTablesForKey in interface ColumnFamilyStoreMBeanpublic void beginLocalSampling(java.lang.String sampler,
int capacity)
ColumnFamilyStoreMBeanbeginLocalSampling in interface ColumnFamilyStoreMBeanpublic javax.management.openmbean.CompositeData finishLocalSampling(java.lang.String sampler,
int count)
throws javax.management.openmbean.OpenDataException
finishLocalSampling in interface ColumnFamilyStoreMBeanjavax.management.openmbean.OpenDataExceptionpublic void cleanupCache()
public ClusteringComparator getComparator()
public void snapshotWithoutFlush(java.lang.String snapshotName)
public java.util.Set<SSTableReader> snapshotWithoutFlush(java.lang.String snapshotName, com.google.common.base.Predicate<SSTableReader> predicate, boolean ephemeral)
ephemeral - If this flag is set to true, the snapshot will be cleaned during next startupprotected static void clearEphemeralSnapshots(Directories directories)
public Refs<SSTableReader> getSnapshotSSTableReader(java.lang.String tag) throws java.io.IOException
java.io.IOExceptionpublic java.util.Set<SSTableReader> snapshot(java.lang.String snapshotName)
snapshotName - the name of the associated with the snapshotpublic java.util.Set<SSTableReader> snapshot(java.lang.String snapshotName, com.google.common.base.Predicate<SSTableReader> predicate, boolean ephemeral)
ephemeral - If this flag is set to true, the snapshot will be cleaned up during next startuppublic boolean snapshotExists(java.lang.String snapshotName)
public long getSnapshotCreationTime(java.lang.String snapshotName)
public void clearSnapshot(java.lang.String snapshotName)
snapshotName - the user supplied snapshot name. If left empty,
all the snapshots will be cleaned.public java.util.Map<java.lang.String,Pair<java.lang.Long,java.lang.Long>> getSnapshotDetails()
public CachedPartition getRawCachedPartition(DecoratedKey key)
public boolean containsCachedParition(DecoratedKey key)
public void invalidateCachedPartition(RowCacheKey key)
public void invalidateCachedPartition(DecoratedKey key)
public ClockAndCount getCachedCounter(java.nio.ByteBuffer partitionKey, Clustering clustering, ColumnDefinition column, CellPath path)
public void putCachedCounter(java.nio.ByteBuffer partitionKey,
Clustering clustering,
ColumnDefinition column,
CellPath path,
ClockAndCount clockAndCount)
public void forceMajorCompaction()
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException
java.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionpublic void forceMajorCompaction(boolean splitOutput)
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException
ColumnFamilyStoreMBeanforceMajorCompaction in interface ColumnFamilyStoreMBeansplitOutput - true if the output of the major compaction should be split in several sstablesjava.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionpublic static java.lang.Iterable<ColumnFamilyStore> all()
public java.lang.Iterable<DecoratedKey> keySamples(Range<Token> range)
public void clearUnsafe()
public void truncateBlocking()
public void dumpMemtable()
public <V> V runWithCompactionsDisabled(java.util.concurrent.Callable<V> callable,
boolean interruptValidation,
boolean interruptViews)
public LifecycleTransaction markAllCompacting(OperationType operationType)
public java.lang.String toString()
toString in class java.lang.Objectpublic void disableAutoCompaction()
public void enableAutoCompaction()
public void enableAutoCompaction(boolean waitForFutures)
waitForFutures - if we should block until autocompaction is donepublic boolean isAutoCompactionDisabled()
isAutoCompactionDisabled in interface ColumnFamilyStoreMBeanpublic CompactionStrategyManager getCompactionStrategyManager()
public void setCompactionThresholds(int minThreshold,
int maxThreshold)
ColumnFamilyStoreMBeansetCompactionThresholds in interface ColumnFamilyStoreMBeanpublic int getMinimumCompactionThreshold()
ColumnFamilyStoreMBeangetMinimumCompactionThreshold in interface ColumnFamilyStoreMBeanpublic void setMinimumCompactionThreshold(int minCompactionThreshold)
ColumnFamilyStoreMBeansetMinimumCompactionThreshold in interface ColumnFamilyStoreMBeanpublic int getMaximumCompactionThreshold()
ColumnFamilyStoreMBeangetMaximumCompactionThreshold in interface ColumnFamilyStoreMBeanpublic void setMaximumCompactionThreshold(int maxCompactionThreshold)
ColumnFamilyStoreMBeansetMaximumCompactionThreshold in interface ColumnFamilyStoreMBeanpublic int getMeanColumns()
public long estimateKeys()
estimateKeys in interface ColumnFamilyStoreMBeanpublic boolean isIndex()
public java.lang.Iterable<ColumnFamilyStore> concatWithIndexes()
public java.util.List<java.lang.String> getBuiltIndexes()
ColumnFamilyStoreMBeangetBuiltIndexes in interface ColumnFamilyStoreMBeanpublic int getUnleveledSSTables()
getUnleveledSSTables in interface ColumnFamilyStoreMBeanpublic int[] getSSTableCountPerLevel()
getSSTableCountPerLevel in interface ColumnFamilyStoreMBeanpublic boolean isEmpty()
public boolean isRowCacheEnabled()
public ReplayPosition discardSSTables(long truncatedAt)
truncatedAt - The timestamp of the truncation
(all SSTables before that timestamp are going be marked as compacted)public double getDroppableTombstoneRatio()
ColumnFamilyStoreMBeangetDroppableTombstoneRatio in interface ColumnFamilyStoreMBeanpublic long trueSnapshotsSize()
trueSnapshotsSize in interface ColumnFamilyStoreMBeanCopyright © 2015 The Apache Software Foundation