Package org.apache.cassandra.io.sstable
Class Downsampling
java.lang.Object
org.apache.cassandra.io.sstable.Downsampling
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe base (down)sampling level determines the granularity at which we can down/upsample. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intgetEffectiveIndexIntervalAfterIndex(int index, int samplingLevel, int minIndexInterval) Calculates the effective index interval after the entry at `index` in an IndexSummary.getOriginalIndexes(int samplingLevel) Returns a list that can be used to translate current index summary indexes to their original index before downsampling.getSamplingPattern(int samplingLevel) Gets a list L of starting indices for downsampling rounds: the first round should start with the offset given by L[0], the second by the offset in L[1], etc.static int[]getStartPoints(int currentSamplingLevel, int newSamplingLevel)
-
Field Details
-
BASE_SAMPLING_LEVEL
public static final int BASE_SAMPLING_LEVELThe base (down)sampling level determines the granularity at which we can down/upsample. A higher number allows us to approximate more closely the ideal sampling. (It could also mean we do a lot of expensive almost-no-op resamplings from N to N-1, but the thresholds in IndexSummaryManager prevent that.) BSL must be a power of two in order to have good sampling patterns. This cannot be changed without rebuilding all index summaries at full sampling; for now we treat it as a constant.- See Also:
-
-
Constructor Details
-
Downsampling
public Downsampling()
-
-
Method Details
-
getSamplingPattern
Gets a list L of starting indices for downsampling rounds: the first round should start with the offset given by L[0], the second by the offset in L[1], etc.- Parameters:
samplingLevel- the base sampling level- Returns:
- A list of `samplingLevel` unique indices between 0 and `samplingLevel`
-
getOriginalIndexes
Returns a list that can be used to translate current index summary indexes to their original index before downsampling. (This repeats every `samplingLevel`, so that's how many entries we return.) For example, if [0, 64] is returned, the current index summary entry at index 0 was originally at index 0, and the current index 1 was originally at index 64.- Parameters:
samplingLevel- the current sampling level for the index summary- Returns:
- a list of original indexes for current summary entries
-
getEffectiveIndexIntervalAfterIndex
public static int getEffectiveIndexIntervalAfterIndex(int index, int samplingLevel, int minIndexInterval) Calculates the effective index interval after the entry at `index` in an IndexSummary. In other words, this returns the number of partitions in the primary on-disk index before the next partition that has an entry in the index summary. If samplingLevel == BASE_SAMPLING_LEVEL, this will be equal to the index interval.- Parameters:
index- an index into an IndexSummarysamplingLevel- the current sampling level for that IndexSummaryminIndexInterval- the min index interval (effective index interval at full sampling)- Returns:
- the number of partitions before the next index summary entry, inclusive on one end
-
getStartPoints
public static int[] getStartPoints(int currentSamplingLevel, int newSamplingLevel)
-