From ee48ed28644fbaf80b287c5ac680f6bf0efc6cb0 Mon Sep 17 00:00:00 2001 From: "Raphael S. Carvalho" Date: Thu, 18 Mar 2021 10:14:42 -0300 Subject: [PATCH] LCS: reshape: tolerate more sstables in level 0 with relaxed mode Relaxed mode, used during initialization, of reshape only tolerates min_threshold (default: 4) L0 sstables. However, relaxed mode should tolerate more sstables in level 0, otherwise boot will have to reshape level 0 every time it crosses the min threshold. So let's make LCS reshape tolerate a max of max_threshold and 32. This change is beneficial because once table is populated, LCS regular compaction can decide to merge those sstables in level 0 into level 1 instead, therefore reducing WA. Refs #8297. Signed-off-by: Raphael S. Carvalho Message-Id: <20210318131442.17935-1-raphaelsc@scylladb.com> (cherry picked from commit e53cedabb118156ecfe47ff0b4f8f5370cec08ee) --- sstables/leveled_compaction_strategy.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sstables/leveled_compaction_strategy.cc b/sstables/leveled_compaction_strategy.cc index 686349d6bd..90975f741b 100644 --- a/sstables/leveled_compaction_strategy.cc +++ b/sstables/leveled_compaction_strategy.cc @@ -178,7 +178,7 @@ leveled_compaction_strategy::get_reshaping_job(std::vector input unsigned max_filled_level = 0; - size_t offstrategy_threshold = std::max(schema->min_compaction_threshold(), 4); + size_t offstrategy_threshold = (mode == reshape_mode::strict) ? std::max(schema->min_compaction_threshold(), 4) : std::max(schema->max_compaction_threshold(), 32); size_t max_sstables = std::max(schema->max_compaction_threshold(), int(offstrategy_threshold)); auto tolerance = [mode] (unsigned level) -> unsigned { if (mode == reshape_mode::strict) {