Class UnifiedCompactionStrategy


  • public class UnifiedCompactionStrategy
    extends AbstractCompactionStrategy
    The design of the unified compaction strategy is described in the accompanying UnifiedCompactionStrategy.md. See CEP-26: https://cwiki.apache.org/confluence/display/CASSANDRA/CEP-26%3A+Unified+Compaction+Strategy
    • Field Detail

      • estimatedRemainingTasks

        protected volatile int estimatedRemainingTasks
      • sstables

        protected final java.util.Set<SSTableReader> sstables
    • Constructor Detail

      • UnifiedCompactionStrategy

        public UnifiedCompactionStrategy​(ColumnFamilyStore cfs,
                                         java.util.Map<java.lang.String,​java.lang.String> options)
      • UnifiedCompactionStrategy

        public UnifiedCompactionStrategy​(ColumnFamilyStore cfs,
                                         java.util.Map<java.lang.String,​java.lang.String> options,
                                         Controller controller)
    • Method Detail

      • validateOptions

        public static java.util.Map<java.lang.String,​java.lang.String> validateOptions​(java.util.Map<java.lang.String,​java.lang.String> options)
                                                                                      throws ConfigurationException
        Throws:
        ConfigurationException
      • fanoutFromScalingParameter

        public static int fanoutFromScalingParameter​(int w)
      • thresholdFromScalingParameter

        public static int thresholdFromScalingParameter​(int w)
      • parseScalingParameter

        public static int parseScalingParameter​(java.lang.String value)
      • printScalingParameter

        public static java.lang.String printScalingParameter​(int w)
      • getMaximalTask

        public java.util.Collection<AbstractCompactionTask> getMaximalTask​(long gcBefore,
                                                                           boolean splitOutput)
        Specified by:
        getMaximalTask in class AbstractCompactionStrategy
        Parameters:
        gcBefore - throw away tombstones older than this
        Returns:
        a compaction task that should be run to compact this columnfamilystore as much as possible. Null if nothing to do. Is responsible for marking its sstables as compaction-pending.
      • getUserDefinedTask

        public AbstractCompactionTask getUserDefinedTask​(java.util.Collection<SSTableReader> sstables,
                                                         long gcBefore)
        Specified by:
        getUserDefinedTask in class AbstractCompactionStrategy
        Parameters:
        sstables - SSTables to compact. Must be marked as compacting.
        gcBefore - throw away tombstones older than this
        Returns:
        a compaction task corresponding to the requested sstables. Will not be null. (Will throw if user requests an invalid compaction.) Is responsible for marking its sstables as compaction-pending.
      • getNextBackgroundTask

        public UnifiedCompactionTask getNextBackgroundTask​(long gcBefore)
        Returns a compaction task to run next. This method is synchronized because task creation is significantly more expensive in UCS; the strategy is stateless, therefore it has to compute the shard/bucket structure on each call.
        Specified by:
        getNextBackgroundTask in class AbstractCompactionStrategy
        Parameters:
        gcBefore - throw away tombstones older than this
        Returns:
        the next background/minor compaction task to run; null if nothing to do. Is responsible for marking its sstables as compaction-pending.
      • getController

        public Controller getController()
      • isSuitableForCompaction

        public static boolean isSuitableForCompaction​(SSTableReader rdr)
      • toString

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