}
float raw_used_rate = osd_map.pool_raw_used_rate(pool_id);
bool per_pool = use_per_pool_stats();
+ bool per_pool_omap = use_per_pool_omap_stats();
dump_object_stat_sum(tbl, f, stat, avail, raw_used_rate, verbose, per_pool,
- pool);
+ per_pool_omap, pool);
if (f) {
f->close_section(); // stats
f->close_section(); // pool
void PGMapDigest::dump_object_stat_sum(
TextTable &tbl, ceph::Formatter *f,
const pool_stat_t &pool_stat, uint64_t avail,
- float raw_used_rate, bool verbose, bool per_pool,
+ float raw_used_rate, bool verbose, bool per_pool, bool per_pool_omap,
const pg_pool_t *pool)
{
const object_stat_sum_t &sum = pool_stat.stats.sum;
raw_used_rate *= (float)(sum.num_object_copies - sum.num_objects_degraded) / sum.num_object_copies;
}
- uint64_t used_bytes = pool_stat.get_allocated_bytes(per_pool);
+ uint64_t used_bytes = pool_stat.get_allocated_bytes(per_pool, per_pool_omap);
float used = 0.0;
// note avail passed in is raw_avail, calc raw_used here.
}
auto avail_res = raw_used_rate ? avail / raw_used_rate : 0;
// an approximation for actually stored user data
- auto stored_normalized = pool_stat.get_user_bytes(raw_used_rate, per_pool);
+ auto stored_normalized = pool_stat.get_user_bytes(raw_used_rate, per_pool,
+ per_pool_omap);
if (f) {
f->dump_int("stored", stored_normalized);
f->dump_int("objects", sum.num_objects);
f->dump_int("compress_bytes_used", statfs.data_compressed_allocated);
f->dump_int("compress_under_bytes", statfs.data_compressed_original);
// Stored by user amplified by replication
- f->dump_int("stored_raw", pool_stat.get_user_bytes(1.0, per_pool));
+ f->dump_int("stored_raw", pool_stat.get_user_bytes(1.0, per_pool,
+ per_pool_omap));
}
} else {
tbl << stringify(byte_u_t(stored_normalized));
bool use_per_pool_stats() const {
return osd_sum.num_osds == osd_sum.num_per_pool_osds;
}
+ bool use_per_pool_omap_stats() const {
+ return osd_sum.num_osds == osd_sum.num_per_pool_omap_osds;
+ }
// recent deltas, and summation
/**
float raw_used_rate,
bool verbose,
bool per_pool,
+ bool per_pool_omap,
const pg_pool_t *pool);
size_t get_num_pg_by_osd(int osd) const {
// In legacy mode used and netto values are the same. But for new per-pool
// collection 'used' provides amount of space ALLOCATED at all related OSDs
// and 'netto' is amount of stored user data.
- uint64_t get_allocated_bytes(bool per_pool) const {
+ uint64_t get_allocated_bytes(bool per_pool, bool per_pool_omap) const {
uint64_t allocated_bytes;
if (per_pool) {
allocated_bytes = store_stats.allocated;
allocated_bytes = stats.sum.num_bytes +
stats.sum.num_bytes_hit_set_archive;
}
- // omap is not broken out by pool by nautilus bluestore
- allocated_bytes += stats.sum.num_omap_bytes;
+ if (per_pool_omap) {
+ allocated_bytes += store_stats.omap_allocated;
+ } else {
+ // omap is not broken out by pool by nautilus bluestore
+ allocated_bytes += stats.sum.num_omap_bytes;
+ }
return allocated_bytes;
}
- uint64_t get_user_bytes(float raw_used_rate, bool per_pool) const {
+ uint64_t get_user_bytes(float raw_used_rate, bool per_pool,
+ bool per_pool_omap) const {
uint64_t user_bytes;
if (per_pool) {
user_bytes = raw_used_rate ? store_stats.data_stored / raw_used_rate : 0;
user_bytes = stats.sum.num_bytes +
stats.sum.num_bytes_hit_set_archive;
}
- // omap is not broken out by pool by nautilus bluestore
- user_bytes += stats.sum.num_omap_bytes;
+ if (per_pool_omap) {
+ user_bytes += store_stats.omap_allocated;
+ } else {
+ // omap is not broken out by pool by nautilus bluestore
+ user_bytes += stats.sum.num_omap_bytes;
+ }
return user_bytes;
}
pool.size = 2;
pool.type = pg_pool_t::TYPE_REPLICATED;
PGMap::dump_object_stat_sum(tbl, nullptr, pool_stat, avail,
- pool.get_size(), verbose, true, &pool);
+ pool.get_size(), verbose, true, true, &pool);
float copies_rate =
(static_cast<float>(sum.num_object_copies - sum.num_objects_degraded) /
sum.num_object_copies) * pool.get_size();
pool.size = 2;
pool.type = pg_pool_t::TYPE_REPLICATED;
PGMap::dump_object_stat_sum(tbl, nullptr, pool_stat, avail,
- pool.get_size(), verbose, true, &pool);
+ pool.get_size(), verbose, true, true, &pool);
unsigned col = 0;
ASSERT_EQ(stringify(byte_u_t(0)), tbl.get(0, col++));
ASSERT_EQ(stringify(si_u_t(0)), tbl.get(0, col++));
pool.type = pg_pool_t::TYPE_REPLICATED;
PGMap::dump_object_stat_sum(tbl, nullptr, pool_stat, avail,
- pool.get_size(), verbose, true, &pool);
+ pool.get_size(), verbose, true, true, &pool);
unsigned col = 0;
ASSERT_EQ(stringify(byte_u_t(0)), tbl.get(0, col++));
ASSERT_EQ(stringify(si_u_t(0)), tbl.get(0, col++));