From 3c5b00ea048c9e7323e322f42433603bbaeef117 Mon Sep 17 00:00:00 2001 From: "Raphael S. Carvalho" Date: Tue, 5 Dec 2023 20:44:38 -0300 Subject: [PATCH] replica: Add storage_group::memtable_count() Signed-off-by: Raphael S. Carvalho --- replica/compaction_group.hh | 2 ++ replica/table.cc | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/replica/compaction_group.hh b/replica/compaction_group.hh index 5d91e730f0..332eabaab8 100644 --- a/replica/compaction_group.hh +++ b/replica/compaction_group.hh @@ -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_groups() noexcept; diff --git a/replica/table.cc b/replica/table.cc index a69cc90d8d..1ee063a236 100644 --- a/replica/table.cc +++ b/replica/table.cc @@ -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 pos) { if (pos && *pos < _flush_rp) { co_return;