CompactionManager (apache-cassandra API)
Date: 2012-05-04

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cassandra.db.compaction
Class CompactionManager

    java.lang.Object
      org.apache.cassandra.db.compaction.CompactionManager

All Implemented Interfaces:
  CompactionManagerMBean

    public class CompactionManager

extends java.lang.Object
implements CompactionManagerMBean

A singleton which manages a private executor of ongoing compactions. A readwrite lock controls whether compactions can proceed: an external consumer can completely stop compactions by acquiring the write half of the lock via getCompactionLock(). Scheduling for compaction is accomplished by swapping sstables to be compacted into a set via DataTracker. New scheduling attempts will ignore currently compacting sstables.

Nested Class Summary
`static interface` | `CompactionManager.CompactionExecutorStatsCollector`

Field Summary
`static CompactionManager` | `instance`
`static java.lang.String` | `MBEAN_OBJECT_NAME`

Constructor Summary
`CompactionManager()`

Method Summary
`void` | `disableAutoCompaction()`
`void` | `forceUserDefinedCompaction(java.lang.String ksname, java.lang.String dataFiles)` Triggers the compaction of user specified sstables.
`int` | `getActiveCompactions()`
`java.util.concurrent.locks.Lock` | `getCompactionLock()`
`java.util.List<CompactionInfo>` | `getCompactions()` List of running compaction objects.
`java.util.List<java.lang.String>` | `getCompactionSummary()` List of running compaction summary strings.
`long` | `getCompletedTasks()`
`int` | `getPendingTasks()`
`void` | `performCleanup(ColumnFamilyStore cfStore, NodeId.OneShotRenewer renewer)`
`void` | `performMaximal(ColumnFamilyStore cfStore)`
`void` | `performScrub(ColumnFamilyStore cfStore)`
`void` | `performSSTableRewrite(ColumnFamilyStore cfStore)`
`java.util.concurrent.Future<java.lang.Integer>` | `submitBackground(ColumnFamilyStore cfs)` Call this whenever a compaction might be needed on the given columnfamily.
`java.util.concurrent.Future<?>` | `submitCacheWrite(AutoSavingCache.Writer writer)`
`java.util.concurrent.Future<?>` | `submitIndexBuild(SecondaryIndexBuilder builder)` Is not scheduled, because it is performing disjoint work from sstable compaction.
`java.util.concurrent.Future<java.lang.Object>` | `submitMaximal(ColumnFamilyStore cfStore, int gcBefore)`
`java.util.concurrent.Future<?>` | `submitTruncate(ColumnFamilyStore main, long truncatedAt)`
`java.util.concurrent.Future<java.lang.Object>` | `submitUserDefined(ColumnFamilyStore cfs, java.util.Collection<Descriptor> dataFiles, int gcBefore)`
`java.util.concurrent.Future<java.lang.Object>` | `submitValidation(ColumnFamilyStore cfStore, AntiEntropyService.Validator validator)` Does not mutate data, so is not scheduled.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### MBEAN_OBJECT_NAME

    public static final java.lang.String MBEAN_OBJECT_NAME

See Also:
  Constant Field Values

### instance

    public static final CompactionManager instance

Constructor Detail

### CompactionManager

    public CompactionManager()

Method Detail

### getCompactionLock

    public java.util.concurrent.locks.Lock getCompactionLock()

  Returns:
    A lock, for which acquisition means no compactions can run.

### submitBackground

    public java.util.concurrent.Future<java.lang.Integer> submitBackground(ColumnFamilyStore cfs)

  Call this whenever a compaction might be needed on the given columnfamily. It's okay to over-call (within reason) since the compactions are single-threaded, and if a call is unnecessary, it will just be no-oped in the bucketing phase.

### performScrub

    public void performScrub(ColumnFamilyStore cfStore)
                      throws java.lang.InterruptedException,
                             java.util.concurrent.ExecutionException

  Throws:
    `java.lang.InterruptedException`
    `java.util.concurrent.ExecutionException`

### performSSTableRewrite

    public void performSSTableRewrite(ColumnFamilyStore cfStore)
                               throws java.lang.InterruptedException,
                                      java.util.concurrent.ExecutionException

  Throws:
    `java.lang.InterruptedException`
    `java.util.concurrent.ExecutionException`

### performCleanup

    public void performCleanup(ColumnFamilyStore cfStore,
                               NodeId.OneShotRenewer renewer)
                        throws java.lang.InterruptedException,
                               java.util.concurrent.ExecutionException

  Throws:
    `java.lang.InterruptedException`
    `java.util.concurrent.ExecutionException`

### performMaximal

    public void performMaximal(ColumnFamilyStore cfStore)
                        throws java.lang.InterruptedException,
                               java.util.concurrent.ExecutionException

  Throws:
    `java.lang.InterruptedException`
    `java.util.concurrent.ExecutionException`

### submitMaximal

    public java.util.concurrent.Future<java.lang.Object> submitMaximal(ColumnFamilyStore cfStore,
                                                                       int gcBefore)

### forceUserDefinedCompaction

    public void forceUserDefinedCompaction(java.lang.String ksname,
                                           java.lang.String dataFiles)

  Description copied from interface: `CompactionManagerMBean`
  Triggers the compaction of user specified sstables.

  Specified by:
    `forceUserDefinedCompaction` in interface `CompactionManagerMBean`
  Parameters:
    `ksname` - the keyspace for the sstables to compact
    `dataFiles` - a comma separated list of sstable filename to compact

### submitUserDefined

    public java.util.concurrent.Future<java.lang.Object> submitUserDefined(ColumnFamilyStore cfs,
                                                                           java.util.Collection<Descriptor> dataFiles,
                                                                           int gcBefore)

### submitValidation

    public java.util.concurrent.Future<java.lang.Object> submitValidation(ColumnFamilyStore cfStore,
                                                                          AntiEntropyService.Validator validator)

  Does not mutate data, so is not scheduled.

### disableAutoCompaction

    public void disableAutoCompaction()

### submitIndexBuild

    public java.util.concurrent.Future<?> submitIndexBuild(SecondaryIndexBuilder builder)

  Is not scheduled, because it is performing disjoint work from sstable compaction.

### submitCacheWrite

    public java.util.concurrent.Future<?> submitCacheWrite(AutoSavingCache.Writer writer)

### submitTruncate

    public java.util.concurrent.Future<?> submitTruncate(ColumnFamilyStore main,
                                                         long truncatedAt)

### getActiveCompactions

    public int getActiveCompactions()

### getCompactions

    public java.util.List<CompactionInfo> getCompactions()

  Description copied from interface: `CompactionManagerMBean`
  List of running compaction objects.

  Specified by:
    `getCompactions` in interface `CompactionManagerMBean`

### getCompactionSummary

    public java.util.List<java.lang.String> getCompactionSummary()

  Description copied from interface: `CompactionManagerMBean`
  List of running compaction summary strings.

  Specified by:
    `getCompactionSummary` in interface `CompactionManagerMBean`

### getPendingTasks

    public int getPendingTasks()

  Specified by:
    `getPendingTasks` in interface `CompactionManagerMBean`
  Returns:
    estimated number of compactions remaining to perform

### getCompletedTasks

    public long getCompletedTasks()

  Specified by:
    `getCompletedTasks` in interface `CompactionManagerMBean`
  Returns:
    number of completed compactions since server [re]start

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2012 The Apache Software Foundation