if (pending_creatings.last_scan_epoch > inc.epoch) {
return pending_creatings;
}
- const auto& pgm = mon->pgservice->get_pg_map();
- if (pgm.last_pg_scan >= creating_pgs.last_scan_epoch) {
- // TODO: please stop updating pgmap with pgstats once the upgrade is completed
- const unsigned total = pending_creatings.pgs.size();
- for (auto& pgid : pgm.creating_pgs) {
- auto st = pgm.pg_stat.find(pgid);
- assert(st != pgm.pg_stat.end());
- auto created = make_pair(st->second.created, st->second.last_scrub_stamp);
- // no need to add the pg, if it already exists in creating_pgs
- pending_creatings.pgs.emplace(pgid, created);
- }
- dout(7) << __func__ << total - pending_creatings.pgs.size()
- << " pgs added from pgmap" << dendl;
- }
+ const unsigned total = pending_creatings.pgs.size();
+ mon->pgservice->maybe_add_creating_pgs(creating_pgs.last_scan_epoch,
+ &pending_creatings);
+ dout(7) << __func__ << total - pending_creatings.pgs.size()
+ << " pgs added from pgmap" << dendl;
unsigned added = 0;
added += scan_for_creating_pgs(osdmap.get_pools(),
inc.old_pools,
#define CEPH_PGSTATSERVICE_H
#include "mon/PGMap.h"
+struct creating_pgs_t;
class PGStatService {
public:
virtual float get_nearfull_ratio() const = 0;
virtual bool have_creating_pgs() const = 0;
virtual bool is_creating_pg(pg_t pgid) const = 0;
+ /**
+ * For upgrades. If the PGMap has newer data than the monitor's new
+ * creating_pgs (scan_epoch), insert them into the passed pending_creates.
+ */
+ virtual void maybe_add_creating_pgs(epoch_t scan_epoch,
+ creating_pgs_t *pending_creates) const = 0;
virtual epoch_t get_min_last_epoch_clean() const = 0;
- virtual PGMap& get_pg_map() = 0;
-
virtual bool have_full_osds() const = 0;
virtual bool have_nearfull_osds() const = 0;
return NULL;
}
- PGMap& get_pg_map() { return parent; }
-
const pool_stat_t& get_pg_sum() const { return parent.pg_sum; }
const osd_stat_t& get_osd_sum() const { return parent.osd_sum; }
bool have_creating_pgs() const { return !parent.creating_pgs.empty(); }
bool is_creating_pg(pg_t pgid) const { return parent.creating_pgs.count(pgid); }
+ virtual void maybe_add_creating_pgs(epoch_t scan_epoch,
+ creating_pgs_t *pending_creates) const {
+ if (parent.last_pg_scan >= scan_epoch) {
+ for (auto& pgid : parent.creating_pgs) {
+ auto st = parent.pg_stat.find(pgid);
+ assert(st != parent.pg_stat.end());
+ auto created = make_pair(st->second.created, st->second.last_scrub_stamp);
+ // no need to add the pg, if it already exists in creating_pgs
+ pending_creatings->pgs.emplace(pgid, created);
+ }
+ }
+ }
epoch_t get_min_last_epoch_clean() const { return parent.get_min_last_epoch_clean(); }
bool have_full_osds() const { return !parent.full_osds.empty(); }