mon/PGStatService: define maybe_trim_creating_pgs() method

replace get_pg_stat() with maybe_trim_creating_pgs(), so it is more
symmetric: maybe_add_creating_pgs() versus maybe_trim_creating_pgs().
and we don't need to return a pointer which is always valid. a const
reference is a better fit in this case.

Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2017-05-16 15:26:41 +08:00 committed by Sage Weil
parent 8e16c68b67
commit ba5c5f3f15

View File

@ -26,7 +26,6 @@
#ifndef CEPH_PGSTATSERVICE_H
#define CEPH_PGSTATSERVICE_H
#include "mon/PGMap.h"
struct creating_pgs_t;
class PGStatService {
@ -43,10 +42,7 @@ public:
virtual const osd_stat_t& get_osd_sum() const = 0;
virtual const osd_stat_t *get_osd_stat(int osd) const = 0;
virtual const ceph::unordered_map<int32_t,osd_stat_t> *get_osd_stat() const = 0;
virtual const ceph::unordered_map<pg_t,pg_stat_t> *get_pg_stat() const {
ceph_abort();
}
virtual const ceph::unordered_map<int32_t,osd_stat_t>& get_osd_stat() const = 0;
virtual float get_full_ratio() const {
ceph_abort();
}
@ -67,6 +63,14 @@ public:
creating_pgs_t *pending_creates) const {
ceph_abort();
}
/**
* For upgrades. If some PGs are created before all OSDs are luminous
* and start sending MOSDPGCreated, we need to be sync with pgmap
*
*/
virtual void maybe_trim_creating_pgs(creating_pgs_t *creates) const {
ceph_abort();
}
virtual epoch_t get_min_last_epoch_clean() const {
ceph_abort();
}