Skip to content

Commit

Permalink
repair: Introduce repair_partition_count_estimation_ratio config option
Browse files Browse the repository at this point in the history
In commit 642f9a1 (repair: Improve
estimated_partitions to reduce memory usage), a 10% hard coded
estimation ratio is used.

This patch introduces a new config option to specify the estimation
ratio of partitions written by repair out of the total partitions.

It is set to 0.1 by default.

Fixes #18615

Closes #18634
  • Loading branch information
asias authored and denesb committed May 13, 2024
1 parent afa870a commit 952dfc6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 2 additions & 0 deletions db/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,8 @@ db::config::config(std::shared_ptr<db::extensions> exts)
, enable_repair_based_node_ops(this, "enable_repair_based_node_ops", liveness::LiveUpdate, value_status::Used, true, "Set true to use enable repair based node operations instead of streaming based.")
, allowed_repair_based_node_ops(this, "allowed_repair_based_node_ops", liveness::LiveUpdate, value_status::Used, "replace,removenode,rebuild,bootstrap,decommission", "A comma separated list of node operations which are allowed to enable repair based node operations. The operations can be bootstrap, replace, removenode, decommission and rebuild.")
, enable_compacting_data_for_streaming_and_repair(this, "enable_compacting_data_for_streaming_and_repair", liveness::LiveUpdate, value_status::Used, true, "Enable the compacting reader, which compacts the data for streaming and repair (load'n'stream included) before sending it to, or synchronizing it with peers. Can reduce the amount of data to be processed by removing dead data, but adds CPU overhead.")
, repair_partition_count_estimation_ratio(this, "repair_partition_count_estimation_ratio", liveness::LiveUpdate, value_status::Used, 0.1,
"Specify the fraction of partitions written by repair out of the total partitions. The value is currently only used for bloom filter estimation. Value is between 0 and 1.")
, ring_delay_ms(this, "ring_delay_ms", value_status::Used, 30 * 1000, "Time a node waits to hear from other nodes before joining the ring in milliseconds. Same as -Dcassandra.ring_delay_ms in cassandra.")
, shadow_round_ms(this, "shadow_round_ms", value_status::Used, 300 * 1000, "The maximum gossip shadow round time. Can be used to reduce the gossip feature check time during node boot up.")
, fd_max_interval_ms(this, "fd_max_interval_ms", value_status::Used, 2 * 1000, "The maximum failure_detector interval time in milliseconds. Interval larger than the maximum will be ignored. Larger cluster may need to increase the default.")
Expand Down
1 change: 1 addition & 0 deletions db/config.hh
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ public:
named_value<bool> enable_repair_based_node_ops;
named_value<sstring> allowed_repair_based_node_ops;
named_value<bool> enable_compacting_data_for_streaming_and_repair;
named_value<double> repair_partition_count_estimation_ratio;
named_value<uint32_t> ring_delay_ms;
named_value<uint32_t> shadow_round_ms;
named_value<uint32_t> fd_max_interval_ms;
Expand Down
17 changes: 9 additions & 8 deletions repair/row_level.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3045,16 +3045,17 @@ class row_level_repair {
_estimated_partitions /= master.all_nodes().size();

// In addition, estimate the difference between nodes is
// less than 10% for regular repair. Underestimation will
// not be a big problem since those sstables produced by
// repair will go through off-strategy later anyway. The
// worst case is that we have a worse false positive ratio
// than expected temporarily when the sstable is still in
// maintenance set.
// less than the specified ratio for regular repair.
// Underestimation will not be a big problem since those
// sstables produced by repair will go through off-strategy
// later anyway. The worst case is that we have a worse
// false positive ratio than expected temporarily when the
// sstable is still in maintenance set.
//
// To save memory and have less different conditions, we
// use the 10% estimation for RBNO repair as well.
_estimated_partitions /= 10;
// use the estimation for RBNO repair as well.

_estimated_partitions *= _shard_task.db.local().get_config().repair_partition_count_estimation_ratio();
}

parallel_for_each(master.all_nodes(), [&, this] (repair_node_state& ns) {
Expand Down

0 comments on commit 952dfc6

Please sign in to comment.