mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
repair: Improve estimated_partitions to reduce memory usage
Currently, we use the sum of the estimated_partitions from each participant node as the estimated_partitions for sstable produced by repair. This way, the estimated_partitions is the biggest possible number of partitions repair would write. Since repair will write only the difference between repair participant nodes, using the biggest possible estimation will overestimate the partitions written by repair, most of the time. The problem is that overestimated partitions makes the bloom filter consume more memory. It is observed that it causes OOM in the field. This patch changes the estimation to use a fraction of the average partitions per node instead of sum. It is still not a perfect estimation but it already improves memory usage significantly. Fixes #18140 Closes scylladb/scylladb#18141
This commit is contained in:
@@ -3035,6 +3035,26 @@ public:
|
||||
});
|
||||
}).get();
|
||||
|
||||
if (!master.all_nodes().empty()) {
|
||||
// Use the average number of partitions, instead of the sum
|
||||
// of the partitions, as the estimated partitions in a
|
||||
// given range. The bigger the estimated partitions, the
|
||||
// more memory bloom filter for the sstable would consume.
|
||||
_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.
|
||||
//
|
||||
// To save memory and have less different conditions, we
|
||||
// use the 10% estimation for RBNO repair as well.
|
||||
_estimated_partitions /= 10;
|
||||
}
|
||||
|
||||
parallel_for_each(master.all_nodes(), [&, this] (repair_node_state& ns) {
|
||||
const auto& node = ns.node;
|
||||
rlogger.trace("Get repair_set_estimated_partitions for node={}, estimated_partitions={}", node, _estimated_partitions);
|
||||
|
||||
Reference in New Issue
Block a user