Expose the dirty_memory_region_group in database and add occupancy to

column_family

This patch adds a getter for the dirty_memory_region_group in the
database object and add an occupency method to column family that
returns the total occupency in all the memtable in the column family.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
This commit is contained in:
Amnon Heiman
2015-08-26 16:00:43 +03:00
parent c102031fe2
commit dd7638cfa9
2 changed files with 15 additions and 0 deletions

View File

@@ -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();

View File

@@ -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