From 0b2cd41dafdb33c9773400a9aa5341d394c685e0 Mon Sep 17 00:00:00 2001 From: "Raphael S. Carvalho" Date: Mon, 13 Jun 2016 15:43:35 -0300 Subject: [PATCH] database: remember sstable level when cleaning it up Cleanup operation wasn't preserving level of sstables. That will have a bad impact on performance because compaction work is lost. Fixes #1317. Signed-off-by: Raphael S. Carvalho Message-Id: <35ce8fbbb4590725bb0414e6a5450fcbe6cb7212.1465843387.git.raphaelsc@scylladb.com> --- database.cc | 2 +- sstables/compaction.hh | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/database.cc b/database.cc index 1c7bea4a74..f4c24ca63c 100644 --- a/database.cc +++ b/database.cc @@ -1054,7 +1054,7 @@ future<> column_family::cleanup_sstables(sstables::compaction_descriptor descrip } std::vector sstable_to_compact({ sst }); - return this->compact_sstables(sstables::compaction_descriptor(std::move(sstable_to_compact)), true); + return this->compact_sstables(sstables::compaction_descriptor(std::move(sstable_to_compact), sst->get_sstable_level()), true); }); } diff --git a/sstables/compaction.hh b/sstables/compaction.hh index 07ceb5620a..1c3ba6da1e 100644 --- a/sstables/compaction.hh +++ b/sstables/compaction.hh @@ -31,19 +31,16 @@ namespace sstables { // List of sstables to be compacted. std::vector sstables; // Level of sstable(s) created by compaction procedure. - int level = 0; + int level; // Threshold size for sstable(s) to be created. - uint64_t max_sstable_bytes = std::numeric_limits::max(); + uint64_t max_sstable_bytes; compaction_descriptor() = default; - compaction_descriptor(std::vector sstables, int level, long max_sstable_bytes) + compaction_descriptor(std::vector sstables, int level = 0, long max_sstable_bytes = std::numeric_limits::max()) : sstables(std::move(sstables)) , level(level) , max_sstable_bytes(max_sstable_bytes) {} - - compaction_descriptor(std::vector sstables) - : sstables(std::move(sstables)) {} }; enum class compaction_type {