Class RepairTokenRangeSplitter
java.lang.Object
org.apache.cassandra.repair.autorepair.RepairTokenRangeSplitter
- All Implemented Interfaces:
IAutoRepairTokenRangeSplitter
The default implementation of
IAutoRepairTokenRangeSplitter that attempts to:
- Create smaller, consistent repair times
- Minimize the impact on hosts
- Reduce overstreaming
- Reduce number of repairs
To achieve these goals, this implementation inspects SSTable metadata to estimate the bytes and number of partitions within a range and splits it accordingly to bound the size of the token ranges used for repair assignments.
Refer to Auto Repair documentation for this implementation for a more thorough breakdown of this implementation.
While this splitter has a lot of tuning parameters, the expectation is that the established default configuration
shall be sensible for all AutoRepairConfig.RepairType's. The following
configuration parameters are offered.
Configuration parameters:
- bytes_per_assignment – Target size (in compressed bytes) for each repair. Throttles incremental repair and anticompaction per schedule after incremental repairs are enabled.
- max_bytes_per_schedule – Maximum data (in compressed bytes) to cover in a single schedule. Acts as a
throttle for the repair cycle workload. Tune this up if writes are outpacing repair, or down if repairs are too
disruptive. Alternatively, adjust
min_repair_interval. - partitions_per_assignment – Maximum number of partitions per repair assignment. Limits the number of partitions in Merkle tree leaves to prevent overstreaming.
- max_tables_per_assignment – Maximum number of tables to include in a single repair assignment.
Especially useful for keyspaces with many tables. Prevents excessive batching of tables that exceed other
parameters like
bytes_per_assignmentorpartitions_per_assignment.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classConveinence builder for establishing defaults by repair type.protected static classImplementation of RepairAssignment that also assigns an estimation of bytes involved in the repair. -
Constructor Summary
ConstructorsConstructorDescriptionRepairTokenRangeSplitter(AutoRepairConfig.RepairType repairType, Map<String, String> parameters) -
Method Summary
Modifier and TypeMethodDescriptionprotected static longgetEstimatedBytes(List<RepairTokenRangeSplitter.SizedRepairAssignment> repairAssignments) getRepairAssignments(boolean primaryRangeOnly, List<PrioritizedRepairPlan> repairPlans) Split the token range you wish to repair into multiple assignments.getRepairAssignmentsForTable(KeyspaceRepairPlan repairPlan, String tableName, Range<Token> tokenRange) voidsetParameter(String key, String value) Update a configuration parameter.
-
Constructor Details
-
RepairTokenRangeSplitter
public RepairTokenRangeSplitter(AutoRepairConfig.RepairType repairType, Map<String, String> parameters)
-
-
Method Details
-
getRepairAssignments
public Iterator<KeyspaceRepairAssignments> getRepairAssignments(boolean primaryRangeOnly, List<PrioritizedRepairPlan> repairPlans) Description copied from interface:IAutoRepairTokenRangeSplitterSplit the token range you wish to repair into multiple assignments. The autorepair framework will repair the assignments from returned subrange iterator in the sequence it's provided.- Specified by:
getRepairAssignmentsin interfaceIAutoRepairTokenRangeSplitter- Parameters:
primaryRangeOnly- Whether to repair only this node's primary ranges or all of its ranges.repairPlans- A list of ordered prioritized repair plans to generate assignments for in order.- Returns:
- iterator of repair assignments, with each element representing a grouping of repair assignments for a given keyspace.
The iterator is traversed lazily
KeyspaceRepairAssignmentsat a time with the intent to try to get the most up-to-date representation of your data (e.g. how much data exists and is unrepaired at a given time).
-
getEstimatedBytes
protected static long getEstimatedBytes(List<RepairTokenRangeSplitter.SizedRepairAssignment> repairAssignments) - Parameters:
repairAssignments- The assignments to sum- Returns:
- The sum of
RepairTokenRangeSplitter.SizedRepairAssignment.getEstimatedBytes()of all given repairAssignments.
-
getRepairAssignmentsForTable
protected List<RepairTokenRangeSplitter.SizedRepairAssignment> getRepairAssignmentsForTable(KeyspaceRepairPlan repairPlan, String tableName, Range<Token> tokenRange) -
getRepairAssignments
protected List<RepairTokenRangeSplitter.SizedRepairAssignment> getRepairAssignments(AutoRepairUtils.SizeEstimate estimate) -
setParameter
Description copied from interface:IAutoRepairTokenRangeSplitterUpdate a configuration parameter. This is meant to be used bynodetool setautorepairconfigto update configuration dynamically.- Specified by:
setParameterin interfaceIAutoRepairTokenRangeSplitter- Parameters:
key- parameter to updatevalue- The value to set to.
-
getParameters
- Specified by:
getParametersin interfaceIAutoRepairTokenRangeSplitter- Returns:
- custom configuration. This is meant to be used by
nodetool getautorepairconfigfor retrieving the splitter configuration.
-