table: add get_staging_sstables

We don't have to go over all sstables in the table to select the
staging sstables out of them, we can get it directly from the
_sstables_staging map.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
This commit is contained in:
Benny Halevy
2022-06-14 10:21:35 +03:00
parent b8b14d76b3
commit 59874b2837
2 changed files with 8 additions and 4 deletions

View File

@@ -173,13 +173,14 @@ void view_update_generator::setup_metrics() {
void view_update_generator::discover_staging_sstables() {
for (auto& x : _db.get_column_families()) {
auto t = x.second->shared_from_this();
for (auto sstables = t->get_sstables(); sstables::shared_sstable sst : *sstables) {
if (sst->requires_view_building()) {
_sstables_with_tables[t].push_back(std::move(sst));
const auto& sstables = t->get_staging_sstables();
_sstables_with_tables[t].reserve(_sstables_with_tables[t].size() + sstables.size());
for (auto& sst : sstables | boost::adaptors::map_values) {
// FIXME: indentation
_sstables_with_tables[t].push_back(sst);
// we're at early stage here, no need to kick _pending_sstables (the
// bulding fiber is not running), neither we can wait on the semaphore
_registration_sem.consume(1);
}
}
}
}

View File

@@ -884,6 +884,9 @@ public:
size_t sstables_count() const;
std::vector<uint64_t> sstable_count_per_level() const;
int64_t get_unleveled_sstables() const;
const auto& get_staging_sstables() const {
return _sstables_staging;
}
void start_compaction();
void trigger_compaction();