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


Field Summary
 java.lang.String columnFamily_
           
 IPartitioner partitioner_
           
 java.lang.String table_
           
 
Method Summary
 void addSSTable(SSTableReader sstable)
           
static java.lang.Iterable<ColumnFamilyStore> all()
           
 java.lang.Iterable<DecoratedKey> allKeySamples()
           
static ColumnFamilyStore createColumnFamilyStore(java.lang.String table, java.lang.String columnFamily)
           
static ColumnFamilyStore createColumnFamilyStore(java.lang.String table, java.lang.String columnFamily, IPartitioner partitioner, CFMetaData metadata)
           
 void forceBlockingFlush()
           
 java.util.concurrent.Future<?> forceFlush()
          Triggers an immediate memtable flush.
 void forceFlushBinary()
           
 void forceFlushIfExpired()
           
 void forceMajorCompaction()
          force a major compaction of this column family
 long getBloomFilterFalsePositives()
           
 double getBloomFilterFalseRatio()
           
 ColumnFamily getColumnFamily(DecoratedKey key, QueryPath path, byte[] start, byte[] finish, boolean reversed, int limit)
           
 ColumnFamily getColumnFamily(DecoratedKey key, QueryPath path, byte[] start, byte[] finish, java.util.List<byte[]> bitmasks, 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()
           
 AbstractType getComparator()
           
 java.lang.String getFlushPath()
           
static int getGenerationFromFileName(java.lang.String filename)
           
 ColumnFamilyStore getIndexedColumnFamilyStore(byte[] column)
           
 java.util.Set<byte[]> getIndexedColumns()
           
 DecoratedKey getIndexKeyFor(byte[] name, byte[] value)
           
 int getKeyCacheSize()
           
 long[] getLifetimeReadLatencyHistogramMicros()
           
 long[] getLifetimeWriteLatencyHistogramMicros()
           
 long getLiveDiskSpaceUsed()
           
 int getLiveSSTableCount()
           
 long getMaxRowSize()
          return the size of the largest compacted row
 int getMeanColumns()
           
 long getMeanRowSize()
          return the mean size of the rows compacted
 int getMemtableColumnsCount()
          Returns the total number of columns present in the memtable.
 int 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.
 long getMinRowSize()
          return the size of the smallest compacted row
 int getPendingTasks()
           
 java.util.List<Row> getRangeSlice(byte[] superColumn, AbstractBounds range, int maxResults, IFilter columnFilter)
          Fetch a range of rows and columns from memtables/sstables.
 ColumnFamily getRawCachedRow(DecoratedKey key)
          raw cached row -- does not fetch the row if it is not present.
 long getReadCount()
           
 long getRecentBloomFilterFalsePositives()
           
 double getRecentBloomFilterFalseRatio()
           
 long[] getRecentReadLatencyHistogramMicros()
           
 double getRecentReadLatencyMicros()
           
 long[] getRecentWriteLatencyHistogramMicros()
           
 double getRecentWriteLatencyMicros()
           
 java.util.Collection<SSTableReader> getSSTables()
           
 Table getTable()
           
 java.lang.String getTempSSTablePath(java.lang.String directory)
           
 long getTotalDiskSpaceUsed()
           
 long getTotalReadLatencyMicros()
           
 long getTotalWriteLatencyMicros()
           
 long getWriteCount()
           
 boolean hasUnreclaimedSpace()
           
 void invalidateRowCache()
          invalidate the row cache; for use after bulk loading via BinaryMemtable
 void loadRowCache()
           
 ColumnFamily newIndexedColumnFamily(byte[] column)
           
static ColumnFamily removeDeleted(ColumnFamily cf, int gcBefore)
           
static ColumnFamily removeDeletedCF(ColumnFamily cf, int gcBefore)
           
 java.util.List<Row> scan(IndexClause clause, AbstractBounds range, IFilter dataFilter)
           
 void snapshot(java.lang.String snapshotName)
          Take a snap shot of this columnfamily store.
static java.util.concurrent.Future<?> submitPostFlush(java.lang.Runnable runnable)
           
 java.lang.String toString()
           
 java.util.concurrent.Future<?> truncate()
          Truncate practically deletes the entire column family's data
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

table_

public final java.lang.String table_

columnFamily_

public final java.lang.String columnFamily_

partitioner_

public final IPartitioner partitioner_
Method Detail

getMinRowSize

public long getMinRowSize()
Description copied from interface: ColumnFamilyStoreMBean
return the size of the smallest compacted row

Specified by:
getMinRowSize in interface ColumnFamilyStoreMBean
Returns:

getMaxRowSize

public long getMaxRowSize()
Description copied from interface: ColumnFamilyStoreMBean
return the size of the largest compacted row

Specified by:
getMaxRowSize in interface ColumnFamilyStoreMBean
Returns:

getMeanRowSize

public long getMeanRowSize()
Description copied from interface: ColumnFamilyStoreMBean
return the mean size of the rows compacted

Specified by:
getMeanRowSize in interface ColumnFamilyStoreMBean
Returns:

getMeanColumns

public int getMeanColumns()

createColumnFamilyStore

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

createColumnFamilyStore

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

getColumnFamilyName

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

getGenerationFromFileName

public static int getGenerationFromFileName(java.lang.String filename)

getFlushPath

public java.lang.String getFlushPath()

getTempSSTablePath

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

forceFlushIfExpired

public void forceFlushIfExpired()

forceFlush

public java.util.concurrent.Future<?> forceFlush()
Description copied from interface: ColumnFamilyStoreMBean
Triggers an immediate memtable flush.

Specified by:
forceFlush in interface ColumnFamilyStoreMBean

forceBlockingFlush

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

forceFlushBinary

public void forceFlushBinary()

removeDeletedCF

public static ColumnFamily removeDeletedCF(ColumnFamily cf,
                                           int gcBefore)

removeDeleted

public static ColumnFamily removeDeleted(ColumnFamily cf,
                                         int gcBefore)

addSSTable

public void addSSTable(SSTableReader sstable)

getTable

public Table getTable()

getMemtableColumnsCount

public int 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.

getMemtableDataSize

public int 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.

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

getSSTables

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

getReadCount

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

getRecentReadLatencyMicros

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

getLifetimeReadLatencyHistogramMicros

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

getRecentReadLatencyHistogramMicros

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

getTotalReadLatencyMicros

public long getTotalReadLatencyMicros()
Specified by:
getTotalReadLatencyMicros in interface ColumnFamilyStoreMBean
Returns:
total read latency (divide by getReadCount() for average)

getPendingTasks

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

getWriteCount

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

getTotalWriteLatencyMicros

public long getTotalWriteLatencyMicros()
Specified by:
getTotalWriteLatencyMicros in interface ColumnFamilyStoreMBean
Returns:
total write latency (divide by getReadCount() for average)

getRecentWriteLatencyMicros

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

getLifetimeWriteLatencyHistogramMicros

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

getRecentWriteLatencyHistogramMicros

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

getColumnFamily

public ColumnFamily getColumnFamily(DecoratedKey key,
                                    QueryPath path,
                                    byte[] start,
                                    byte[] finish,
                                    java.util.List<byte[]> bitmasks,
                                    boolean reversed,
                                    int limit)

getColumnFamily

public ColumnFamily getColumnFamily(DecoratedKey key,
                                    QueryPath path,
                                    byte[] start,
                                    byte[] 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

getRangeSlice

public java.util.List<Row> getRangeSlice(byte[] superColumn,
                                         AbstractBounds range,
                                         int maxResults,
                                         IFilter columnFilter)
                                  throws java.util.concurrent.ExecutionException,
                                         java.lang.InterruptedException
Fetch 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.
maxResults - Maximum rows to return
columnFilter - description of the columns we're interested in for each row
Returns:
true if we found all keys we were looking for, otherwise false
Throws:
java.util.concurrent.ExecutionException
java.lang.InterruptedException

scan

public java.util.List<Row> scan(IndexClause clause,
                                AbstractBounds range,
                                IFilter dataFilter)

getComparator

public AbstractType getComparator()

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

loadRowCache

public void loadRowCache()

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

getLiveDiskSpaceUsed

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

getLiveSSTableCount

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

getRawCachedRow

public ColumnFamily getRawCachedRow(DecoratedKey key)
raw cached row -- does not fetch the row if it is not present. not counted in cache statistics.


forceMajorCompaction

public void forceMajorCompaction()
Description copied from interface: ColumnFamilyStoreMBean
force a major compaction of this column family

Specified by:
forceMajorCompaction in interface ColumnFamilyStoreMBean

invalidateRowCache

public void invalidateRowCache()
Description copied from interface: ColumnFamilyStoreMBean
invalidate the row cache; for use after bulk loading via BinaryMemtable

Specified by:
invalidateRowCache in interface ColumnFamilyStoreMBean

getKeyCacheSize

public int getKeyCacheSize()

all

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

allKeySamples

public java.lang.Iterable<DecoratedKey> allKeySamples()

getMemtablesPendingFlush

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

truncate

public java.util.concurrent.Future<?> truncate()
                                        throws java.io.IOException
Truncate practically deletes the entire column family's data

Returns:
a Future to the delete operation. Call the future's get() to make sure the column family has been deleted
Throws:
java.io.IOException

submitPostFlush

public static java.util.concurrent.Future<?> submitPostFlush(java.lang.Runnable runnable)

getBloomFilterFalsePositives

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

getRecentBloomFilterFalsePositives

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

getBloomFilterFalseRatio

public double getBloomFilterFalseRatio()
Specified by:
getBloomFilterFalseRatio in interface ColumnFamilyStoreMBean

getRecentBloomFilterFalseRatio

public double getRecentBloomFilterFalseRatio()
Specified by:
getRecentBloomFilterFalseRatio in interface ColumnFamilyStoreMBean

getIndexedColumns

public java.util.Set<byte[]> getIndexedColumns()

getIndexedColumnFamilyStore

public ColumnFamilyStore getIndexedColumnFamilyStore(byte[] column)

newIndexedColumnFamily

public ColumnFamily newIndexedColumnFamily(byte[] column)

getIndexKeyFor

public DecoratedKey getIndexKeyFor(byte[] name,
                                   byte[] value)

toString

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


Copyright © 2010 The Apache Software Foundation