diff --git a/database.cc b/database.cc index c8eb7af038..3e3f5295af 100644 --- a/database.cc +++ b/database.cc @@ -93,6 +93,15 @@ column_family::sstables_as_mutation_source() { column_family::~column_family() { } + +logalloc::occupancy_stats column_family::occupancy() const { + logalloc::occupancy_stats res; + for (auto m : *_memtables.get()) { + res += m->region().occupancy(); + } + return res; +} + static bool belongs_to_current_shard(const mutation& m) { return dht::shard_of(m.token()) == engine().cpu_id(); diff --git a/database.hh b/database.hh index d3c579414f..28d45ebc1d 100644 --- a/database.hh +++ b/database.hh @@ -159,6 +159,8 @@ public: const row_cache& get_row_cache() const { return _cache; } + + logalloc::occupancy_stats occupancy() const; public: column_family(schema_ptr schema, config cfg, db::commitlog& cl, compaction_manager&); column_family(schema_ptr schema, config cfg, no_commitlog, compaction_manager&); @@ -490,6 +492,10 @@ public: } future<> flush_all_memtables(); + + const logalloc::region_group& dirty_memory_region_group() const { + return _dirty_memory_region_group; + } }; // FIXME: stub