mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-21 17:10:35 +00:00
database: add compact_sstables to column_family
compact_all_sstables is about selecting all available sstables for compaction and executing a compaction code on them. This compaction code was moved to a more generic function called compact_sstables, which will compact a list of given sstables. Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
This commit is contained in:
23
database.cc
23
database.cc
@@ -455,15 +455,10 @@ column_family::stop() {
|
||||
});
|
||||
}
|
||||
|
||||
// FIXME: this is just an example, should be changed to something more general
|
||||
// Note: We assume that the column_family does not get destroyed during compaction.
|
||||
future<>
|
||||
column_family::compact_all_sstables() {
|
||||
auto sstables_to_compact =
|
||||
make_lw_shared<std::vector<sstables::shared_sstable>>();
|
||||
for (auto&& entry : *_sstables) {
|
||||
sstables_to_compact->push_back(entry.second);
|
||||
}
|
||||
column_family::compact_sstables(std::vector<sstables::shared_sstable> sstables) {
|
||||
auto sstables_to_compact = make_lw_shared<std::vector<sstables::shared_sstable>>(std::move(sstables));
|
||||
|
||||
auto new_tables = make_lw_shared<std::vector<
|
||||
std::pair<unsigned, sstables::shared_sstable>>>();
|
||||
auto create_sstable = [this, new_tables] {
|
||||
@@ -505,6 +500,18 @@ column_family::compact_all_sstables() {
|
||||
});
|
||||
}
|
||||
|
||||
// FIXME: this is just an example, should be changed to something more general
|
||||
// Note: We assume that the column_family does not get destroyed during compaction.
|
||||
future<>
|
||||
column_family::compact_all_sstables() {
|
||||
std::vector<sstables::shared_sstable> sstables;
|
||||
sstables.reserve(_sstables->size());
|
||||
for (auto&& entry : *_sstables) {
|
||||
sstables.push_back(entry.second);
|
||||
}
|
||||
return compact_sstables(std::move(sstables));
|
||||
}
|
||||
|
||||
void column_family::start_compaction() {
|
||||
set_compaction_strategy(sstables::compaction_strategy_type::null);
|
||||
|
||||
|
||||
@@ -158,6 +158,8 @@ public:
|
||||
// It doesn't flush the current memtable first. It's just a ad-hoc method,
|
||||
// not a real compaction policy.
|
||||
future<> compact_all_sstables();
|
||||
// Compact all sstables provided in the vector.
|
||||
future<> compact_sstables(std::vector<lw_shared_ptr<sstables::sstable>> sstables);
|
||||
|
||||
size_t sstables_count();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user