Skip to content

Commit

Permalink
repair: Consider memory bloat when calculate repair parallelism
Browse files Browse the repository at this point in the history
The repair parallelism is calculated by the number of memory allocated to
repair and memory usage per repair instance. Currently, it does not
consider memory bloat issues (e.g., issue #8640) which cause repair to
use more memory and cause std::bad_alloc.

Be more conservative when calculating the parallelism to avoid repair
using too much memory.

Fixes #8641

Closes #8652
  • Loading branch information
asias authored and tgrabiec committed May 14, 2021
1 parent c1cb7d8 commit b8749f5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion repair/repair.cc
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ float node_ops_metrics::repair_finished_percentage() {
tracker::tracker(size_t nr_shards, size_t max_repair_memory)
: _shutdown(false)
, _repairs(nr_shards) {
auto nr = std::max(size_t(1), size_t(max_repair_memory / max_repair_memory_per_range()));
auto nr = std::max(size_t(1), size_t(max_repair_memory / max_repair_memory_per_range() / 4));
rlogger.info("Setting max_repair_memory={}, max_repair_memory_per_range={}, max_repair_ranges_in_parallel={}",
max_repair_memory, max_repair_memory_per_range(), nr);
_range_parallelism_semaphores.reserve(nr_shards);
Expand Down

0 comments on commit b8749f5

Please sign in to comment.