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_
           
 
Method Summary
 void addSSTable(SSTableReader sstable)
           
 void addToCompactedRowStats(java.lang.Long rowsize)
           
static java.lang.Iterable<ColumnFamilyStore> all()
           
 java.lang.Iterable<IndexSummary.KeyPosition> allIndexPositions()
           
static ColumnFamilyStore createColumnFamilyStore(java.lang.String table, java.lang.String columnFamily)
           
 long estimateKeys()
           
 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(QueryFilter filter)
           
 ColumnFamily getColumnFamily(QueryFilter filter, int gcBefore)
          get a list of columns starting from a given column, in a specified order.
 ColumnFamily getColumnFamily(java.lang.String key, QueryPath path, byte[] start, byte[] finish, boolean reversed, int limit)
           
 java.lang.String getColumnFamilyName()
           
 AbstractType getComparator()
           
 java.lang.String getFlushPath()
           
static int getGenerationFromFileName(java.lang.String filename)
           
 int getKeyCacheCapacity()
           
 int getKeyCacheSize()
           
 long[] getLifetimeReadLatencyHistogramMicros()
           
 long[] getLifetimeWriteLatencyHistogramMicros()
           
 long getLiveDiskSpaceUsed()
           
 int getLiveSSTableCount()
           
 long getMaxRowCompactedSize()
          return the size of the largest compacted row
 long getMeanRowCompactedSize()
          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 getMinRowCompactedSize()
          return the size of the smallest compacted row
 int getPendingTasks()
           
 RangeSliceReply getRangeSlice(byte[] super_column, AbstractBounds range, int keyMax, SliceRange sliceRange, java.util.List<byte[]> columnNames)
           
 ColumnFamily getRawCachedRow(java.lang.String 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()
           
 int getRowCacheCapacity()
           
 int getRowCacheSize()
           
 java.util.Collection<SSTableReader> getSSTables()
           
 Table getTable()
           
 java.lang.String getTempSSTableFileName()
           
 long getTotalDiskSpaceUsed()
           
 long getTotalReadLatencyMicros()
           
 long getTotalWriteLatencyMicros()
           
 long getWriteCount()
           
 boolean hasUnreclaimedSpace()
           
 void initRowCache()
           
 void invalidateRowCache()
          invalidate the row cache; for use after bulk loading via BinaryMemtable
 boolean isKeyInRemainingSSTables(DecoratedKey key, java.util.Set<SSTable> sstablesToIgnore)
          Uses bloom filters to check if key may be present in any sstable in this ColumnFamilyStore, minus a set of provided ones.
 boolean isSuper()
           
 java.util.Iterator<DecoratedKey> memtableKeyIterator(DecoratedKey startWith)
           
protected  java.util.Set<java.lang.String> readSavedCache(java.io.File path, boolean sort)
           
static ColumnFamily removeDeleted(ColumnFamily cf, int gcBefore)
           
 void snapshot(java.lang.String snapshotName)
          Take a snap shot of this columnfamily store.
 java.util.concurrent.Future<?> submitKeyCacheWrite()
           
 java.util.concurrent.Future<?> submitRowCacheWrite()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

columnFamily_

public final java.lang.String columnFamily_
Method Detail

readSavedCache

protected java.util.Set<java.lang.String> readSavedCache(java.io.File path,
                                                         boolean sort)
                                                  throws java.io.IOException
Throws:
java.io.IOException

initRowCache

public void initRowCache()

submitKeyCacheWrite

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

submitRowCacheWrite

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

addToCompactedRowStats

public void addToCompactedRowStats(java.lang.Long rowsize)

getMinRowCompactedSize

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

Specified by:
getMinRowCompactedSize in interface ColumnFamilyStoreMBean
Returns:

getMaxRowCompactedSize

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

Specified by:
getMaxRowCompactedSize in interface ColumnFamilyStoreMBean
Returns:

getMeanRowCompactedSize

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

Specified by:
getMeanRowCompactedSize in interface ColumnFamilyStoreMBean
Returns:

createColumnFamilyStore

public static ColumnFamilyStore createColumnFamilyStore(java.lang.String table,
                                                        java.lang.String columnFamily)
                                                 throws java.io.IOException
Throws:
java.io.IOException

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()

getTempSSTableFileName

public java.lang.String getTempSSTableFileName()

forceFlushIfExpired

public void forceFlushIfExpired()
                         throws java.io.IOException
Throws:
java.io.IOException

forceFlush

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

Specified by:
forceFlush in interface ColumnFamilyStoreMBean
Throws:
java.io.IOException

forceBlockingFlush

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

forceFlushBinary

public void forceFlushBinary()

removeDeleted

public static ColumnFamily removeDeleted(ColumnFamily cf,
                                         int gcBefore)

isKeyInRemainingSSTables

public boolean isKeyInRemainingSSTables(DecoratedKey key,
                                        java.util.Set<SSTable> sstablesToIgnore)
Uses bloom filters to check if key may be present in any sstable in this ColumnFamilyStore, minus a set of provided ones. Because BFs are checked, negative returns ensure that the key is not present in the checked SSTables, but positive ones doesn't ensure key presence.


addSSTable

public void addSSTable(SSTableReader sstable)

getTable

public Table getTable()

isSuper

public boolean isSuper()

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

memtableKeyIterator

public java.util.Iterator<DecoratedKey> memtableKeyIterator(DecoratedKey startWith)
                                                     throws java.util.concurrent.ExecutionException,
                                                            java.lang.InterruptedException
Throws:
java.util.concurrent.ExecutionException
java.lang.InterruptedException

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(java.lang.String key,
                                    QueryPath path,
                                    byte[] start,
                                    byte[] finish,
                                    boolean reversed,
                                    int limit)
                             throws java.io.IOException
Throws:
java.io.IOException

getColumnFamily

public ColumnFamily getColumnFamily(QueryFilter filter)
                             throws java.io.IOException
Throws:
java.io.IOException

getColumnFamily

public ColumnFamily getColumnFamily(QueryFilter filter,
                                    int gcBefore)
                             throws java.io.IOException
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
Throws:
java.io.IOException

getRangeSlice

public RangeSliceReply getRangeSlice(byte[] super_column,
                                     AbstractBounds range,
                                     int keyMax,
                                     SliceRange sliceRange,
                                     java.util.List<byte[]> columnNames)
                              throws java.io.IOException,
                                     java.util.concurrent.ExecutionException,
                                     java.lang.InterruptedException
Parameters:
super_column -
range: - either a Bounds, which includes start key, or a Range, which does not.
keyMax - maximum number of keys to process, regardless of startKey/finishKey
sliceRange - may be null if columnNames is specified. specifies contiguous columns to return in what order.
columnNames - may be null if sliceRange is specified. specifies which columns to return in what order. @return list of key->list tuples.
Throws:
java.io.IOException
java.util.concurrent.ExecutionException
java.lang.InterruptedException

getComparator

public AbstractType getComparator()

snapshot

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

Parameters:
snapshotName - the name of the associated with the snapshot
Throws:
java.io.IOException

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(java.lang.String 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

getRowCacheCapacity

public int getRowCacheCapacity()

getKeyCacheCapacity

public int getKeyCacheCapacity()

getRowCacheSize

public int getRowCacheSize()

getKeyCacheSize

public int getKeyCacheSize()

all

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

allIndexPositions

public java.lang.Iterable<IndexSummary.KeyPosition> allIndexPositions()

getMemtablesPendingFlush

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

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

estimateKeys

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


Copyright © 2010 The Apache Software Foundation