Class Controller
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final intprotected final ColumnFamilyStoreprotected final MonotonicClockprotected longstatic final intDefault base shard count, used when a base count is not explicitly supplied.static final longprotected final longprotected final longprotected final booleanprotected static final org.slf4j.Loggerprotected final intprotected longprotected final Overlaps.InclusionMethodprotected final doubleprotected final double[]protected final double -
Method Summary
Modifier and TypeMethodDescriptionstatic ControllerfromOptions(ColumnFamilyStore cfs, Map<String, String> options) doublegetBaseSstableSize(int F) longintgetFanout(int index) longReturn the flush sstable size in bytes.booleandoublegetMaxLevelDensity(int index, double minSize) intgetNumShards(double localDensity) Calculate the number of shards to split the local token space in for the given SSTable density.intgetScalingParameter(int index) doublegetSurvivalFactor(int index) intgetThreshold(int index) intintdoubleReturn the overlap inclusion method to use when combining overlap sections into a bucket.static int[]static StringprintScalingParameters(int[] parameters) random()Random number generator to be used for the selection of tasks.toString()validateOptions(Map<String, String> options)
-
Field Details
-
logger
protected static final org.slf4j.Logger logger -
DEFAULT_BASE_SHARD_COUNT
public static final int DEFAULT_BASE_SHARD_COUNTDefault base shard count, used when a base count is not explicitly supplied. This value applies as long as the table is not a system one, and directories are not defined. For others a base count of 1 is used as system tables are usually small and do not need as much compaction parallelism, while having directories defined provides for parallelism in a different way. -
DEFAULT_TARGET_SSTABLE_SIZE
public static final long DEFAULT_TARGET_SSTABLE_SIZE -
cfs
-
clock
-
survivalFactors
protected final double[] survivalFactors -
minSSTableSize
protected volatile long minSSTableSize -
flushSizeOverride
protected final long flushSizeOverride -
currentFlushSize
protected volatile long currentFlushSize -
maxSSTablesToCompact
protected final int maxSSTablesToCompact -
expiredSSTableCheckFrequency
protected final long expiredSSTableCheckFrequency -
ignoreOverlapsInExpirationCheck
protected final boolean ignoreOverlapsInExpirationCheck -
baseShardCount
protected final int baseShardCount -
targetSSTableSize
protected final double targetSSTableSize -
sstableGrowthModifier
protected final double sstableGrowthModifier -
overlapInclusionMethod
-
-
Method Details
-
getScalingParameter
public int getScalingParameter(int index) - Parameters:
index-- Returns:
- the scaling parameter W
-
toString
-
getFanout
public int getFanout(int index) -
getThreshold
public int getThreshold(int index) -
getNumShards
public int getNumShards(double localDensity) Calculate the number of shards to split the local token space in for the given SSTable density. This is calculated as a power-of-two multiple of baseShardCount, so that the expected size of resulting SSTables is between sqrt(0.5) and sqrt(2) times the target size, which is calculated from targetSSTableSize to grow at the given sstableGrowthModifier of the exponential growth of the density.Additionally, if a minimum SSTable size is set, we can go below the baseShardCount when that would result in SSTables smaller than that minimum. Note that in the case of a non-power-of-two base count, we will only split to divisors of baseShardCount.
Note that to get the SSTables resulting from this splitting within the bounds, the density argument must be normalized to the span that is being split. In other words, if no disks are defined, the density should be scaled by the token coverage of the locally-owned ranges. If multiple data directories are defined, the density should be scaled by the token coverage of the respective data directory. That is, localDensity = size / span, where the span is normalized so that span = 1 when the data covers the range that is being split.
-
getSurvivalFactor
public double getSurvivalFactor(int index) - Parameters:
index-- Returns:
- the survival factor o
-
getFlushSizeBytes
public long getFlushSizeBytes()Return the flush sstable size in bytes. This is usually obtained from the observed sstable flush sizes, refreshed when it differs significantly from the current values. It can also be set by the user in the options.- Returns:
- the flush size in bytes.
-
getIgnoreOverlapsInExpirationCheck
public boolean getIgnoreOverlapsInExpirationCheck()- Returns:
- whether is allowed to drop expired SSTables without checking if partition keys appear in other SSTables. Same behavior as in TWCS.
-
getExpiredSSTableCheckFrequency
public long getExpiredSSTableCheckFrequency() -
fromOptions
-
validateOptions
public static Map<String,String> validateOptions(Map<String, String> options) throws ConfigurationException- Throws:
ConfigurationException
-
getBaseSstableSize
public double getBaseSstableSize(int F) -
getMaxLevelDensity
public double getMaxLevelDensity(int index, double minSize) -
maxThroughput
public double maxThroughput() -
maxConcurrentCompactions
public int maxConcurrentCompactions() -
maxSSTablesToCompact
public int maxSSTablesToCompact() -
random
Random number generator to be used for the selection of tasks. Replaced by some tests. -
overlapInclusionMethod
Return the overlap inclusion method to use when combining overlap sections into a bucket. For example, with SSTables A(0, 5), B(2, 9), C(6, 12), D(10, 12) whose overlap sections calculation returns [AB, BC, CD], - NONE means no sections are to be merged. AB, BC and CD will be separate buckets, compactions AB, BC and CD will be added separately, thus some SSTables will be partially used / single-source compacted, likely to be recompacted again with the next selected bucket. - SINGLE means only overlaps of the sstables in the selected bucket will be added. AB+BC will be one bucket, and CD will be another (as BC is already used). A middle ground of sorts, should reduce overcompaction but still has some. - TRANSITIVE means a transitive closure of overlapping sstables will be selected. AB+BC+CD will be in the same bucket, selected compactions will apply to all overlapping sstables and no overcompaction will be done, at the cost of reduced compaction parallelism and increased length of the operation. TRANSITIVE is the default and makes most sense. NONE is a closer approximation to operation of legacy UCS. The option is exposed for experimentation. -
parseScalingParameters
-
printScalingParameters
-