replica: Add storage_group::memtable_count()

Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com>
This commit is contained in:
Raphael S. Carvalho
2023-12-05 20:44:38 -03:00
parent e5a9299696
commit 3c5b00ea04
2 changed files with 7 additions and 0 deletions

View File

@@ -175,6 +175,8 @@ public:
const dht::token_range& token_range() const noexcept;
size_t memtable_count() const noexcept;
compaction_group_ptr& main_compaction_group() noexcept;
utils::small_vector<compaction_group*, 3> compaction_groups() noexcept;

View File

@@ -2024,6 +2024,11 @@ size_t compaction_group::memtable_count() const noexcept {
return _memtables->size();
}
size_t storage_group::memtable_count() const noexcept {
auto memtable_count = [] (const compaction_group_ptr& cg) { return cg ? cg->memtable_count() : 0; };
return memtable_count(_main_cg);
}
future<> table::flush(std::optional<db::replay_position> pos) {
if (pos && *pos < _flush_rp) {
co_return;