org.apache.cassandra.db
Class ColumnFamilyStore

java.lang.Object
  extended by org.apache.cassandra.db.ColumnFamilyStore
All Implemented Interfaces:
ColumnFamilyStoreMBean

public class ColumnFamilyStore
extends java.lang.Object
implements ColumnFamilyStoreMBean


Nested Class Summary
static class ColumnFamilyStore.AbstractScanIterator
           
static class ColumnFamilyStore.ViewFragment
           
 
Field Summary
 java.lang.String columnFamily
           
 Directories directories
           
 SecondaryIndexManager indexManager
           
 java.util.concurrent.ConcurrentMap<java.nio.ByteBuffer,java.nio.ByteBuffer> internedNames
           
 CFMetaData metadata
           
 ColumnFamilyMetrics metric
           
 IPartitioner partitioner
           
static java.util.concurrent.ExecutorService postFlushExecutor
           
 Table table
           
 
Method Summary
 void addSSTable(SSTableReader sstable)
           
 void addSSTables(java.util.Collection<SSTableReader> sstables)
           
static java.lang.Iterable<ColumnFamilyStore> all()
           
static java.util.List<ColumnFamilyStore> allUserDefined()
           
 void apply(DecoratedKey key, ColumnFamily columnFamily, SecondaryIndexManager.Updater indexer)
          Insert/Update the column family for this key.
 void clearSnapshot(java.lang.String snapshotName)
           
 void clearUnsafe()
          For testing.
 java.lang.Iterable<ColumnFamilyStore> concatWithIndexes()
           
 boolean containsCachedRow(DecoratedKey key)
           
static ColumnFamilyStore createColumnFamilyStore(Table table, java.lang.String columnFamily, boolean loadSSTables)
           
static ColumnFamilyStore createColumnFamilyStore(Table table, java.lang.String columnFamily, IPartitioner partitioner, CFMetaData metadata)
           
 SSTableWriter createCompactionWriter(long estimatedRows, java.io.File location, java.util.Collection<SSTableReader> sstables)
           
 void disableAutoCompaction()
          Disable automatic compaction.
 ReplayPosition discardSSTables(long truncatedAt)
          Discard all SSTables that were created before given timestamp.
 void enableAutoCompaction()
           
 long estimateKeys()
           
 java.util.List<Row> filter(ColumnFamilyStore.AbstractScanIterator rowIterator, ExtendedFilter filter)
           
 void forceBlockingFlush()
           
 void forceCleanup(CounterId.OneShotRenewer renewer)
           
 java.util.concurrent.Future<?> forceFlush()
           
 void forceMajorCompaction()
          force a major compaction of this column family
 int gcBefore()
           
 java.util.Set<SSTableReader> getAndReferenceOverlappingSSTables(java.util.Collection<SSTableReader> sstables)
          like getOverlappingSSTables, but acquires references before returning
 long getBloomFilterDiskSpaceUsed()
           
 long getBloomFilterFalsePositives()
           
 double getBloomFilterFalseRatio()
           
 java.util.List<java.lang.String> getBuiltIndexes()
          Returns a list of the names of the built column indexes for current store
 ColumnFamily getColumnFamily(DecoratedKey key, QueryPath path, java.nio.ByteBuffer start, java.nio.ByteBuffer finish, boolean reversed, int limit)
           
 ColumnFamily getColumnFamily(QueryFilter filter)
          get a list of columns starting from a given column, in a specified order.
 java.lang.String getColumnFamilyName()
           
 AbstractCompactionStrategy getCompactionStrategy()
           
 java.lang.String getCompactionStrategyClass()
          Gets the compaction strategy class name
 AbstractType<?> getComparator()
           
 java.util.Map<java.lang.String,java.lang.String> getCompressionParameters()
          Get the compression parameters
 double getCompressionRatio()
           
 DataTracker getDataTracker()
          Package protected for access from the CompactionManager.
 long[] getEstimatedColumnCountHistogram()
           
 long[] getEstimatedRowSizeHistogram()
           
 long getExpectedCompactedFileSize(java.lang.Iterable<SSTableReader> sstables, OperationType operation)
          Calculate expected file size of SSTable after compaction.
 long[] getLifetimeReadLatencyHistogramMicros()
           
 long[] getLifetimeWriteLatencyHistogramMicros()
           
 long getLiveDiskSpaceUsed()
           
 int getLiveSSTableCount()
           
 int getMaximumCompactionThreshold()
          Gets the maximum number of sstables in queue before compaction kicks off
 long getMaxRowSize()
           
 SSTableReader getMaxSizeFile(java.lang.Iterable<SSTableReader> sstables)
           
 int getMeanColumns()
           
 long getMeanRowSize()
           
 long getMemtableColumnsCount()
          Returns the total number of columns present in the memtable.
 long getMemtableDataSize()
          Returns the total amount of data stored in the memtable, including column related overhead.
 java.util.Set<Memtable> getMemtablesPendingFlush()
           
 int getMemtableSwitchCount()
          Returns the number of times that a flush has resulted in the memtable being switched out.
 int getMinimumCompactionThreshold()
          Gets the minimum number of sstables in queue before compaction kicks off
 long getMinRowSize()
           
 java.util.Set<SSTableReader> getOverlappingSSTables(java.util.Collection<SSTableReader> sstables)
           
 int getPendingTasks()
           
 java.util.List<Row> getRangeSlice(java.nio.ByteBuffer superColumn, AbstractBounds<RowPosition> range, int maxResults, IDiskAtomFilter columnFilter, java.util.List<org.apache.cassandra.thrift.IndexExpression> rowFilter)
           
 java.util.List<Row> getRangeSlice(java.nio.ByteBuffer superColumn, AbstractBounds<RowPosition> range, int maxResults, IDiskAtomFilter columnFilter, java.util.List<org.apache.cassandra.thrift.IndexExpression> rowFilter, boolean countCQL3Rows, boolean isPaging)
           
 ColumnFamily getRawCachedRow(DecoratedKey key)
           
 long getReadCount()
           
 long getRecentBloomFilterFalsePositives()
           
 double getRecentBloomFilterFalseRatio()
           
 long[] getRecentReadLatencyHistogramMicros()
           
 double getRecentReadLatencyMicros()
           
 long[] getRecentSSTablesPerReadHistogram()
           
 long[] getRecentWriteLatencyHistogramMicros()
           
 double getRecentWriteLatencyMicros()
           
 ColumnFamilyStore.AbstractScanIterator getSequentialIterator(java.nio.ByteBuffer superColumn, AbstractBounds<RowPosition> range, IDiskAtomFilter columnFilter)
          Iterate over a range of rows and columns from memtables/sstables.
 long getSnapshotCreationTime(java.lang.String snapshotName)
           
 java.util.List<SSTableReader> getSnapshotSSTableReader(java.lang.String tag)
           
 int[] getSSTableCountPerLevel()
           
 java.util.Collection<SSTableReader> getSSTables()
           
 java.util.List<java.lang.String> getSSTablesForKey(java.lang.String key)
          Returns a list of filenames that contain the given key on this node
 long[] getSSTablesPerReadHistogram()
           
 java.lang.String getTempSSTablePath(java.io.File directory)
           
 ColumnFamily getTopLevelColumns(QueryFilter filter, int gcBefore, boolean forCache)
           
 long getTotalDiskSpaceUsed()
           
 long getTotalMemtableLiveSize()
           
 long getTotalReadLatencyMicros()
           
 long getTotalWriteLatencyMicros()
           
 java.util.Set<SSTableReader> getUncompactingSSTables()
           
 int getUnleveledSSTables()
           
 long getWriteCount()
           
 boolean hasUnreclaimedSpace()
           
 void initRowCache()
           
 java.nio.ByteBuffer internOrCopy(java.nio.ByteBuffer name, Allocator allocator)
           
 void invalidate()
          call when dropping or renaming a CF.
 void invalidateCachedRow(DecoratedKey key)
           
 void invalidateCachedRow(RowCacheKey key)
           
 boolean isCompactionDisabled()
           
 boolean isEmpty()
           
 boolean isIndex()
          true if this CFS contains secondary index data
 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
 void markCompacted(java.util.Collection<SSTableReader> sstables, OperationType compactionType)
           
 java.util.Collection<SSTableReader> markCurrentSSTablesReferenced()
          Get the current sstables, acquiring references on all of them.
 ColumnFamilyStore.ViewFragment markReferenced(DecoratedKey key)
           
 ColumnFamilyStore.ViewFragment markReferenced(RowPosition startWith, RowPosition stopAt)
           
 java.nio.ByteBuffer maybeIntern(java.nio.ByteBuffer name)
           
 void maybeUpdateRowCache(DecoratedKey key, ColumnFamily columnFamily)
           
 long oldestUnflushedMemtable()
          Returns the creation time of the oldest memtable not fully flushed yet.
static void rebuildSecondaryIndex(java.lang.String ksName, java.lang.String cfName, java.lang.String... idxNames)
           
 void reload()
           
static ColumnFamily removeDeleted(ColumnFamily cf, int gcBefore)
           
static ColumnFamily removeDeleted(ColumnFamily cf, int gcBefore, SecondaryIndexManager.Updater indexer)
           
static ColumnFamily removeDeletedCF(ColumnFamily cf, int gcBefore)
           
static void removeDeletedColumnsOnly(ColumnFamily cf, int gcBefore)
           
 void replaceCompactedSSTables(java.util.Collection<SSTableReader> sstables, java.lang.Iterable<SSTableReader> replacements, OperationType compactionType)
           
 void scrub()
           
static void scrubDataDirectories(java.lang.String table, java.lang.String columnFamily)
          Removes unnecessary files from the cf directory at startup: these include temp files, orphans, zero-length files and compacted sstables.
 java.util.List<Row> search(java.util.List<org.apache.cassandra.thrift.IndexExpression> clause, AbstractBounds<RowPosition> range, int maxResults, IDiskAtomFilter dataFilter)
           
 java.util.List<Row> search(java.util.List<org.apache.cassandra.thrift.IndexExpression> clause, AbstractBounds<RowPosition> range, int maxResults, IDiskAtomFilter dataFilter, boolean countCQL3Rows)
           
 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
 void snapshot(java.lang.String snapshotName)
          Take a snap shot of this columnfamily store.
 boolean snapshotExists(java.lang.String snapshotName)
           
 void snapshotWithoutFlush(java.lang.String snapshotName)
           
 void sstablesRewrite()
           
 java.util.concurrent.Future<?> switchMemtable(boolean writeCommitLog, boolean forceSwitch)
          Switch and flush the current memtable, if it was dirty.
 java.lang.String toString()
           
 java.util.concurrent.Future<?> truncate()
          Truncate deletes the entire column family's data with no expensive tombstone creation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

postFlushExecutor

public static final java.util.concurrent.ExecutorService postFlushExecutor

table

public final Table table

columnFamily

public final java.lang.String columnFamily

metadata

public final CFMetaData metadata

partitioner

public final IPartitioner partitioner

indexManager

public final SecondaryIndexManager indexManager

internedNames

public final java.util.concurrent.ConcurrentMap<java.nio.ByteBuffer,java.nio.ByteBuffer> internedNames

directories

public final Directories directories

metric

public final ColumnFamilyMetrics metric
Method Detail

reload

public void reload()

setCompactionStrategyClass

public void setCompactionStrategyClass(java.lang.String compactionStrategyClass)
Description copied from interface: ColumnFamilyStoreMBean
Sets the compaction strategy by class name

Specified by:
setCompactionStrategyClass in interface ColumnFamilyStoreMBean
Parameters:
compactionStrategyClass - the name of the compaction strategy class

getCompactionStrategyClass

public java.lang.String getCompactionStrategyClass()
Description copied from interface: ColumnFamilyStoreMBean
Gets the compaction strategy class name

Specified by:
getCompactionStrategyClass in interface ColumnFamilyStoreMBean

getCompressionParameters

public java.util.Map<java.lang.String,java.lang.String> getCompressionParameters()
Description copied from interface: ColumnFamilyStoreMBean
Get the compression parameters

Specified by:
getCompressionParameters in interface ColumnFamilyStoreMBean

setCompressionParameters

public void setCompressionParameters(java.util.Map<java.lang.String,java.lang.String> opts)
Description copied from interface: ColumnFamilyStoreMBean
Set the compression parameters

Specified by:
setCompressionParameters in interface ColumnFamilyStoreMBean
Parameters:
opts - map of string names to values

setCrcCheckChance

public void setCrcCheckChance(double crcCheckChance)
Description copied from interface: ColumnFamilyStoreMBean
Set new crc check chance

Specified by:
setCrcCheckChance in interface ColumnFamilyStoreMBean

invalidate

public void invalidate()
call when dropping or renaming a CF. Performs mbean housekeeping and invalidates CFS to other operations


getMinRowSize

public long getMinRowSize()
Specified by:
getMinRowSize in interface ColumnFamilyStoreMBean
Returns:
the size of the smallest compacted row
See Also:
ColumnFamilyMetrics.minRowSize

getMaxRowSize

public long getMaxRowSize()
Specified by:
getMaxRowSize in interface ColumnFamilyStoreMBean
Returns:
the size of the largest compacted row
See Also:
ColumnFamilyMetrics.maxRowSize

getMeanRowSize

public long getMeanRowSize()
Specified by:
getMeanRowSize in interface ColumnFamilyStoreMBean
Returns:
the size of the smallest compacted row
See Also:
ColumnFamilyMetrics.meanRowSize

getMeanColumns

public int getMeanColumns()

createColumnFamilyStore

public static ColumnFamilyStore createColumnFamilyStore(Table table,
                                                        java.lang.String columnFamily,
                                                        boolean loadSSTables)

createColumnFamilyStore

public static ColumnFamilyStore createColumnFamilyStore(Table table,
                                                        java.lang.String columnFamily,
                                                        IPartitioner partitioner,
                                                        CFMetaData metadata)

scrubDataDirectories

public static void scrubDataDirectories(java.lang.String table,
                                        java.lang.String columnFamily)
Removes unnecessary files from the cf directory at startup: these include temp files, orphans, zero-length files and compacted sstables. Files that cannot be recognized will be ignored.


initRowCache

public void initRowCache()

loadNewSSTables

public static void loadNewSSTables(java.lang.String ksName,
                                   java.lang.String cfName)
See #StorageService.loadNewSSTables(String, String) for more info

Parameters:
ksName - The keyspace name
cfName - The columnFamily name

loadNewSSTables

public void loadNewSSTables()
#Scan through Keyspace/ColumnFamily's data directory determine which SSTables should be loaded and load them

Specified by:
loadNewSSTables in interface ColumnFamilyStoreMBean

rebuildSecondaryIndex

public static void rebuildSecondaryIndex(java.lang.String ksName,
                                         java.lang.String cfName,
                                         java.lang.String... idxNames)

getColumnFamilyName

public java.lang.String getColumnFamilyName()
Specified by:
getColumnFamilyName in interface ColumnFamilyStoreMBean
Returns:
the name of the column family

getTempSSTablePath

public java.lang.String getTempSSTablePath(java.io.File directory)

switchMemtable

public java.util.concurrent.Future<?> switchMemtable(boolean writeCommitLog,
                                                     boolean forceSwitch)
Switch and flush the current memtable, if it was dirty. The forceSwitch flag allow to force switching the memtable even if it is clean (though in that case we don't flush, as there is no point).


forceFlush

public java.util.concurrent.Future<?> forceFlush()

forceBlockingFlush

public void forceBlockingFlush()
                        throws java.util.concurrent.ExecutionException,
                               java.lang.InterruptedException
Throws:
java.util.concurrent.ExecutionException
java.lang.InterruptedException

maybeUpdateRowCache

public void maybeUpdateRowCache(DecoratedKey key,
                                ColumnFamily columnFamily)

apply

public void apply(DecoratedKey key,
                  ColumnFamily columnFamily,
                  SecondaryIndexManager.Updater indexer)
Insert/Update the column family for this key. Caller is responsible for acquiring Table.flusherLock! param @ lock - lock that needs to be used. param @ key - key for update/insert param @ columnFamily - columnFamily changes


removeDeletedCF

public static ColumnFamily removeDeletedCF(ColumnFamily cf,
                                           int gcBefore)

removeDeleted

public static ColumnFamily removeDeleted(ColumnFamily cf,
                                         int gcBefore)

removeDeleted

public static ColumnFamily removeDeleted(ColumnFamily cf,
                                         int gcBefore,
                                         SecondaryIndexManager.Updater indexer)

removeDeletedColumnsOnly

public static void removeDeletedColumnsOnly(ColumnFamily cf,
                                            int gcBefore)

getOverlappingSSTables

public java.util.Set<SSTableReader> getOverlappingSSTables(java.util.Collection<SSTableReader> sstables)
Parameters:
sstables -
Returns:
sstables whose key range overlaps with that of the given sstables, not including itself. (The given sstables may or may not overlap with each other.)

getAndReferenceOverlappingSSTables

public java.util.Set<SSTableReader> getAndReferenceOverlappingSSTables(java.util.Collection<SSTableReader> sstables)
like getOverlappingSSTables, but acquires references before returning


addSSTable

public void addSSTable(SSTableReader sstable)

addSSTables

public void addSSTables(java.util.Collection<SSTableReader> sstables)

getExpectedCompactedFileSize

public long getExpectedCompactedFileSize(java.lang.Iterable<SSTableReader> sstables,
                                         OperationType operation)
Calculate expected file size of SSTable after compaction. If operation type is 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.

Parameters:
sstables - SSTables to calculate expected compacted file size
operation - Operation type
Returns:
Expected file size of SSTable after compaction

getMaxSizeFile

public SSTableReader getMaxSizeFile(java.lang.Iterable<SSTableReader> sstables)

forceCleanup

public void forceCleanup(CounterId.OneShotRenewer renewer)
                  throws java.util.concurrent.ExecutionException,
                         java.lang.InterruptedException
Throws:
java.util.concurrent.ExecutionException
java.lang.InterruptedException

scrub

public void scrub()
           throws java.util.concurrent.ExecutionException,
                  java.lang.InterruptedException
Throws:
java.util.concurrent.ExecutionException
java.lang.InterruptedException

sstablesRewrite

public void sstablesRewrite()
                     throws java.util.concurrent.ExecutionException,
                            java.lang.InterruptedException
Throws:
java.util.concurrent.ExecutionException
java.lang.InterruptedException

markCompacted

public void markCompacted(java.util.Collection<SSTableReader> sstables,
                          OperationType compactionType)

replaceCompactedSSTables

public void replaceCompactedSSTables(java.util.Collection<SSTableReader> sstables,
                                     java.lang.Iterable<SSTableReader> replacements,
                                     OperationType compactionType)

isValid

public boolean isValid()

getMemtableColumnsCount

public long getMemtableColumnsCount()
Description copied from interface: ColumnFamilyStoreMBean
Returns the total number of columns present in the memtable.

Specified by:
getMemtableColumnsCount in interface ColumnFamilyStoreMBean
Returns:
The number of columns.
See Also:
ColumnFamilyMetrics.memtableColumnsCount

getMemtableDataSize

public long getMemtableDataSize()
Description copied from interface: ColumnFamilyStoreMBean
Returns the total amount of data stored in the memtable, including column related overhead.

Specified by:
getMemtableDataSize in interface ColumnFamilyStoreMBean
Returns:
The size in bytes.
See Also:
ColumnFamilyMetrics.memtableDataSize

getTotalMemtableLiveSize

public long getTotalMemtableLiveSize()

getMemtableSwitchCount

public int getMemtableSwitchCount()
Description copied from interface: ColumnFamilyStoreMBean
Returns the number of times that a flush has resulted in the memtable being switched out.

Specified by:
getMemtableSwitchCount in interface ColumnFamilyStoreMBean
Returns:
the number of memtable switches
See Also:
ColumnFamilyMetrics.memtableSwitchCount

getDataTracker

public DataTracker getDataTracker()
Package protected for access from the CompactionManager.


getSSTables

public java.util.Collection<SSTableReader> getSSTables()

getUncompactingSSTables

public java.util.Set<SSTableReader> getUncompactingSSTables()

getRecentSSTablesPerReadHistogram

public long[] getRecentSSTablesPerReadHistogram()
Specified by:
getRecentSSTablesPerReadHistogram in interface ColumnFamilyStoreMBean
Returns:
a histogram of the number of sstable data files accessed per read: reading this property resets it
See Also:
ColumnFamilyMetrics.recentSSTablesPerRead

getSSTablesPerReadHistogram

public long[] getSSTablesPerReadHistogram()
Specified by:
getSSTablesPerReadHistogram in interface ColumnFamilyStoreMBean
Returns:
a histogram of the number of sstable data files accessed per read
See Also:
ColumnFamilyMetrics.sstablesPerReadHistogram

getReadCount

public long getReadCount()
Specified by:
getReadCount in interface ColumnFamilyStoreMBean
Returns:
the number of read operations on this column family
See Also:
ColumnFamilyMetrics.readLatency

getRecentReadLatencyMicros

public double getRecentReadLatencyMicros()
Specified by:
getRecentReadLatencyMicros in interface ColumnFamilyStoreMBean
Returns:
average latency per read operation since the last call
See Also:
ColumnFamilyMetrics.readLatency

getLifetimeReadLatencyHistogramMicros

public long[] getLifetimeReadLatencyHistogramMicros()
Specified by:
getLifetimeReadLatencyHistogramMicros in interface ColumnFamilyStoreMBean
Returns:
an array representing the latency histogram
See Also:
ColumnFamilyMetrics.readLatency

getRecentReadLatencyHistogramMicros

public long[] getRecentReadLatencyHistogramMicros()
Specified by:
getRecentReadLatencyHistogramMicros in interface ColumnFamilyStoreMBean
Returns:
an array representing the latency histogram
See Also:
ColumnFamilyMetrics.readLatency

getTotalReadLatencyMicros

public long getTotalReadLatencyMicros()
Specified by:
getTotalReadLatencyMicros in interface ColumnFamilyStoreMBean
Returns:
total read latency (divide by getReadCount() for average)
See Also:
ColumnFamilyMetrics.readLatency

getPendingTasks

public int getPendingTasks()
Specified by:
getPendingTasks in interface ColumnFamilyStoreMBean
Returns:
the estimated number of tasks pending for this column family
See Also:
ColumnFamilyMetrics.pendingTasks

getWriteCount

public long getWriteCount()
Specified by:
getWriteCount in interface ColumnFamilyStoreMBean
Returns:
the number of write operations on this column family
See Also:
ColumnFamilyMetrics.writeLatency

getTotalWriteLatencyMicros

public long getTotalWriteLatencyMicros()
Specified by:
getTotalWriteLatencyMicros in interface ColumnFamilyStoreMBean
Returns:
total write latency (divide by getReadCount() for average)
See Also:
ColumnFamilyMetrics.writeLatency

getRecentWriteLatencyMicros

public double getRecentWriteLatencyMicros()
Specified by:
getRecentWriteLatencyMicros in interface ColumnFamilyStoreMBean
Returns:
average latency per write operation since the last call
See Also:
ColumnFamilyMetrics.writeLatency

getLifetimeWriteLatencyHistogramMicros

public long[] getLifetimeWriteLatencyHistogramMicros()
Specified by:
getLifetimeWriteLatencyHistogramMicros in interface ColumnFamilyStoreMBean
Returns:
an array representing the latency histogram
See Also:
ColumnFamilyMetrics.writeLatency

getRecentWriteLatencyHistogramMicros

public long[] getRecentWriteLatencyHistogramMicros()
Specified by:
getRecentWriteLatencyHistogramMicros in interface ColumnFamilyStoreMBean
Returns:
an array representing the latency histogram
See Also:
ColumnFamilyMetrics.writeLatency

getColumnFamily

public ColumnFamily getColumnFamily(DecoratedKey key,
                                    QueryPath path,
                                    java.nio.ByteBuffer start,
                                    java.nio.ByteBuffer finish,
                                    boolean reversed,
                                    int limit)

getColumnFamily

public ColumnFamily getColumnFamily(QueryFilter filter)
get a list of columns starting from a given column, in a specified order. only the latest version of a column is returned.

Returns:
null if there is no data and no tombstones; otherwise a ColumnFamily

gcBefore

public int gcBefore()

markCurrentSSTablesReferenced

public java.util.Collection<SSTableReader> markCurrentSSTablesReferenced()
Get the current sstables, acquiring references on all of them. The caller is in charge of releasing the references on the sstables. See markCurrentViewReferenced() above.


markReferenced

public ColumnFamilyStore.ViewFragment markReferenced(DecoratedKey key)
Returns:
a ViewFragment containing the sstables and memtables that may need to be merged for the given @param key, according to the interval tree

markReferenced

public ColumnFamilyStore.ViewFragment markReferenced(RowPosition startWith,
                                                     RowPosition stopAt)
Returns:
a ViewFragment containing the sstables and memtables that may need to be merged for rows between @param startWith and @param stopAt, inclusive, according to the interval tree

getSSTablesForKey

public java.util.List<java.lang.String> getSSTablesForKey(java.lang.String key)
Description copied from interface: ColumnFamilyStoreMBean
Returns a list of filenames that contain the given key on this node

Specified by:
getSSTablesForKey in interface ColumnFamilyStoreMBean
Returns:
list of filenames containing the key

getTopLevelColumns

public ColumnFamily getTopLevelColumns(QueryFilter filter,
                                       int gcBefore,
                                       boolean forCache)

getSequentialIterator

public ColumnFamilyStore.AbstractScanIterator getSequentialIterator(java.nio.ByteBuffer superColumn,
                                                                    AbstractBounds<RowPosition> range,
                                                                    IDiskAtomFilter columnFilter)
Iterate over a range of rows and columns from memtables/sstables.

Parameters:
superColumn - optional SuperColumn to slice subcolumns of; null to slice top-level columns
range - Either a Bounds, which includes start key, or a Range, which does not.
columnFilter - description of the columns we're interested in for each row

getRangeSlice

public java.util.List<Row> getRangeSlice(java.nio.ByteBuffer superColumn,
                                         AbstractBounds<RowPosition> range,
                                         int maxResults,
                                         IDiskAtomFilter columnFilter,
                                         java.util.List<org.apache.cassandra.thrift.IndexExpression> rowFilter)

getRangeSlice

public java.util.List<Row> getRangeSlice(java.nio.ByteBuffer superColumn,
                                         AbstractBounds<RowPosition> range,
                                         int maxResults,
                                         IDiskAtomFilter columnFilter,
                                         java.util.List<org.apache.cassandra.thrift.IndexExpression> rowFilter,
                                         boolean countCQL3Rows,
                                         boolean isPaging)

search

public java.util.List<Row> search(java.util.List<org.apache.cassandra.thrift.IndexExpression> clause,
                                  AbstractBounds<RowPosition> range,
                                  int maxResults,
                                  IDiskAtomFilter dataFilter)

search

public java.util.List<Row> search(java.util.List<org.apache.cassandra.thrift.IndexExpression> clause,
                                  AbstractBounds<RowPosition> range,
                                  int maxResults,
                                  IDiskAtomFilter dataFilter,
                                  boolean countCQL3Rows)

filter

public java.util.List<Row> filter(ColumnFamilyStore.AbstractScanIterator rowIterator,
                                  ExtendedFilter filter)

getComparator

public AbstractType<?> getComparator()

snapshotWithoutFlush

public void snapshotWithoutFlush(java.lang.String snapshotName)

getSnapshotSSTableReader

public java.util.List<SSTableReader> getSnapshotSSTableReader(java.lang.String tag)
                                                       throws java.io.IOException
Throws:
java.io.IOException

snapshot

public void snapshot(java.lang.String snapshotName)
Take a snap shot of this columnfamily store.

Parameters:
snapshotName - the name of the associated with the snapshot

snapshotExists

public boolean snapshotExists(java.lang.String snapshotName)

getSnapshotCreationTime

public long getSnapshotCreationTime(java.lang.String snapshotName)

clearSnapshot

public void clearSnapshot(java.lang.String snapshotName)

hasUnreclaimedSpace

public boolean hasUnreclaimedSpace()

getTotalDiskSpaceUsed

public long getTotalDiskSpaceUsed()
Specified by:
getTotalDiskSpaceUsed in interface ColumnFamilyStoreMBean
Returns:
total disk space used by SSTables belonging to this CF, including obsolete ones waiting to be GC'd
See Also:
ColumnFamilyMetrics.totalDiskSpaceUsed

getLiveDiskSpaceUsed

public long getLiveDiskSpaceUsed()
Specified by:
getLiveDiskSpaceUsed in interface ColumnFamilyStoreMBean
Returns:
disk space used by SSTables belonging to this CF
See Also:
ColumnFamilyMetrics.liveDiskSpaceUsed

getLiveSSTableCount

public int getLiveSSTableCount()
Specified by:
getLiveSSTableCount in interface ColumnFamilyStoreMBean
Returns:
the number of SSTables on disk for this CF
See Also:
ColumnFamilyMetrics.liveSSTableCount

getRawCachedRow

public ColumnFamily getRawCachedRow(DecoratedKey key)
Returns:
the cached row for @param key if it is already present in the cache. That is, unlike getThroughCache, it will not readAndCache the row if it is not present, nor are these calls counted in cache statistics. Note that this WILL cause deserialization of a SerializingCache row, so if all you need to know is whether a row is present or not, use containsCachedRow instead.

containsCachedRow

public boolean containsCachedRow(DecoratedKey key)
Returns:
true if @param key is contained in the row cache

invalidateCachedRow

public void invalidateCachedRow(RowCacheKey key)

invalidateCachedRow

public void invalidateCachedRow(DecoratedKey key)

forceMajorCompaction

public void forceMajorCompaction()
                          throws java.lang.InterruptedException,
                                 java.util.concurrent.ExecutionException
Description copied from interface: ColumnFamilyStoreMBean
force a major compaction of this column family

Specified by:
forceMajorCompaction in interface ColumnFamilyStoreMBean
Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException

all

public static java.lang.Iterable<ColumnFamilyStore> all()

allUserDefined

public static java.util.List<ColumnFamilyStore> allUserDefined()

keySamples

public java.lang.Iterable<DecoratedKey> keySamples(Range<Token> range)

clearUnsafe

public void clearUnsafe()
For testing. No effort is made to clear historical or even the current memtables, nor for thread safety. All we do is wipe the sstable containers clean, while leaving the actual data files present on disk. (This allows tests to easily call loadNewSSTables on them.)


truncate

public java.util.concurrent.Future<?> truncate()
                                        throws java.util.concurrent.ExecutionException,
                                               java.lang.InterruptedException
Truncate deletes the entire column family's data with no expensive tombstone creation

Returns:
a Future to the delete operation. Call the future's get() to make sure the column family has been deleted
Throws:
java.util.concurrent.ExecutionException
java.lang.InterruptedException

getBloomFilterFalsePositives

public long getBloomFilterFalsePositives()
Specified by:
getBloomFilterFalsePositives in interface ColumnFamilyStoreMBean
See Also:
ColumnFamilyMetrics.bloomFilterFalsePositives

getRecentBloomFilterFalsePositives

public long getRecentBloomFilterFalsePositives()
Specified by:
getRecentBloomFilterFalsePositives in interface ColumnFamilyStoreMBean
See Also:
ColumnFamilyMetrics.recentBloomFilterFalsePositives

getBloomFilterFalseRatio

public double getBloomFilterFalseRatio()
Specified by:
getBloomFilterFalseRatio in interface ColumnFamilyStoreMBean
See Also:
ColumnFamilyMetrics.bloomFilterFalseRatio

getRecentBloomFilterFalseRatio

public double getRecentBloomFilterFalseRatio()
Specified by:
getRecentBloomFilterFalseRatio in interface ColumnFamilyStoreMBean
See Also:
ColumnFamilyMetrics.recentBloomFilterFalseRatio

getBloomFilterDiskSpaceUsed

public long getBloomFilterDiskSpaceUsed()
Specified by:
getBloomFilterDiskSpaceUsed in interface ColumnFamilyStoreMBean
See Also:
ColumnFamilyMetrics.bloomFilterDiskSpaceUsed

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

disableAutoCompaction

public void disableAutoCompaction()
Description copied from interface: ColumnFamilyStoreMBean
Disable automatic compaction.

Specified by:
disableAutoCompaction in interface ColumnFamilyStoreMBean

enableAutoCompaction

public void enableAutoCompaction()

getCompactionStrategy

public AbstractCompactionStrategy getCompactionStrategy()

setCompactionThresholds

public void setCompactionThresholds(int minThreshold,
                                    int maxThreshold)
Description copied from interface: ColumnFamilyStoreMBean
Sets the maximum and maximum number of SSTables in queue before compaction kicks off

Specified by:
setCompactionThresholds in interface ColumnFamilyStoreMBean

getMinimumCompactionThreshold

public int getMinimumCompactionThreshold()
Description copied from interface: ColumnFamilyStoreMBean
Gets the minimum number of sstables in queue before compaction kicks off

Specified by:
getMinimumCompactionThreshold in interface ColumnFamilyStoreMBean

setMinimumCompactionThreshold

public void setMinimumCompactionThreshold(int minCompactionThreshold)
Description copied from interface: ColumnFamilyStoreMBean
Sets the minimum number of sstables in queue before compaction kicks off

Specified by:
setMinimumCompactionThreshold in interface ColumnFamilyStoreMBean

getMaximumCompactionThreshold

public int getMaximumCompactionThreshold()
Description copied from interface: ColumnFamilyStoreMBean
Gets the maximum number of sstables in queue before compaction kicks off

Specified by:
getMaximumCompactionThreshold in interface ColumnFamilyStoreMBean

setMaximumCompactionThreshold

public void setMaximumCompactionThreshold(int maxCompactionThreshold)
Description copied from interface: ColumnFamilyStoreMBean
Sets the maximum number of sstables in queue before compaction kicks off

Specified by:
setMaximumCompactionThreshold in interface ColumnFamilyStoreMBean

isCompactionDisabled

public boolean isCompactionDisabled()

estimateKeys

public long estimateKeys()
Specified by:
estimateKeys in interface ColumnFamilyStoreMBean

getEstimatedRowSizeHistogram

public long[] getEstimatedRowSizeHistogram()
Specified by:
getEstimatedRowSizeHistogram in interface ColumnFamilyStoreMBean
See Also:
ColumnFamilyMetrics.estimatedRowSizeHistogram

getEstimatedColumnCountHistogram

public long[] getEstimatedColumnCountHistogram()
Specified by:
getEstimatedColumnCountHistogram in interface ColumnFamilyStoreMBean
See Also:
ColumnFamilyMetrics.estimatedColumnCountHistogram

getCompressionRatio

public double getCompressionRatio()
Specified by:
getCompressionRatio in interface ColumnFamilyStoreMBean
See Also:
ColumnFamilyMetrics.compressionRatio

isIndex

public boolean isIndex()
true if this CFS contains secondary index data


internOrCopy

public java.nio.ByteBuffer internOrCopy(java.nio.ByteBuffer name,
                                        Allocator allocator)

maybeIntern

public java.nio.ByteBuffer maybeIntern(java.nio.ByteBuffer name)

createCompactionWriter

public SSTableWriter createCompactionWriter(long estimatedRows,
                                            java.io.File location,
                                            java.util.Collection<SSTableReader> sstables)

concatWithIndexes

public java.lang.Iterable<ColumnFamilyStore> concatWithIndexes()

getMemtablesPendingFlush

public java.util.Set<Memtable> getMemtablesPendingFlush()

getBuiltIndexes

public java.util.List<java.lang.String> getBuiltIndexes()
Description copied from interface: ColumnFamilyStoreMBean
Returns a list of the names of the built column indexes for current store

Specified by:
getBuiltIndexes in interface ColumnFamilyStoreMBean
Returns:
list of the index names

getUnleveledSSTables

public int getUnleveledSSTables()
Specified by:
getUnleveledSSTables in interface ColumnFamilyStoreMBean
Returns:
the number of SSTables in L0. Always return 0 if Leveled compaction is not enabled.

getSSTableCountPerLevel

public int[] getSSTableCountPerLevel()
Specified by:
getSSTableCountPerLevel in interface ColumnFamilyStoreMBean
Returns:
sstable count for each level. null unless leveled compaction is used. array index corresponds to level(int[0] is for level 0, ...).

oldestUnflushedMemtable

public long oldestUnflushedMemtable()
Returns the creation time of the oldest memtable not fully flushed yet.


isEmpty

public boolean isEmpty()

discardSSTables

public ReplayPosition discardSSTables(long truncatedAt)
Discard all SSTables that were created before given timestamp. Caller is responsible to obtain compactionLock.

Parameters:
truncatedAt - The timestamp of the truncation (all SSTables before that timestamp are going be marked as compacted)
Returns:
the most recent replay position of the truncated data


Copyright © 2012 The Apache Software Foundation