From 63d62a7db26826a1c8ed29041c2fcb3db9f15ce3 Mon Sep 17 00:00:00 2001 From: Eliran Sinvani Date: Tue, 5 Jul 2022 16:29:05 +0300 Subject: [PATCH] commitlog: set flush threshold to half of the limit size Once we enable commitlog hard limit by default, we would like to have some room in case flushing memtables takes some time to catch up. This threshold is half the limit. Signed-off-by: Eliran Sinvani --- db/commitlog/commitlog.cc | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/db/commitlog/commitlog.cc b/db/commitlog/commitlog.cc index 745840fbd4..2576b687a3 100644 --- a/db/commitlog/commitlog.cc +++ b/db/commitlog/commitlog.cc @@ -1384,15 +1384,7 @@ db::commitlog::segment_manager::segment_manager(config c) if (cfg.commitlog_flush_threshold_in_mb.has_value()) { return size_t(std::ceil(*cfg.commitlog_flush_threshold_in_mb / double(smp::count))) * 1024 * 1024; } else { - if (max_disk_size >= (max_size*2)) { - return max_disk_size - max_size; - } else { - if (max_disk_size > (max_size/2)) { - return max_disk_size - (max_size/2); - } else { - return max_disk_size - max_disk_size/3; - } - } + return max_disk_size / 2; } }()) , _flush_semaphore(cfg.max_active_flushes)