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 <raphaelsc@scylladb.com>
Message-Id: <35ce8fbbb4590725bb0414e6a5450fcbe6cb7212.1465843387.git.raphaelsc@scylladb.com>
This commit is contained in:
Raphael S. Carvalho
2016-06-13 15:43:35 -03:00
committed by Pekka Enberg
parent d3960f0bbb
commit 0b2cd41daf
2 changed files with 4 additions and 7 deletions

View File

@@ -1054,7 +1054,7 @@ future<> column_family::cleanup_sstables(sstables::compaction_descriptor descrip
}
std::vector<sstables::shared_sstable> 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);
});
}

View File

@@ -31,19 +31,16 @@ namespace sstables {
// List of sstables to be compacted.
std::vector<sstables::shared_sstable> 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<uint64_t>::max();
uint64_t max_sstable_bytes;
compaction_descriptor() = default;
compaction_descriptor(std::vector<sstables::shared_sstable> sstables, int level, long max_sstable_bytes)
compaction_descriptor(std::vector<sstables::shared_sstable> sstables, int level = 0, long max_sstable_bytes = std::numeric_limits<uint64_t>::max())
: sstables(std::move(sstables))
, level(level)
, max_sstable_bytes(max_sstable_bytes) {}
compaction_descriptor(std::vector<sstables::shared_sstable> sstables)
: sstables(std::move(sstables)) {}
};
enum class compaction_type {