if (is_mon_create) {
pending_creates_from_mon++;
} else {
- pending_creates_from_osd.emplace(pgid.pgid);
+ bool is_primary = osdmap->get_pg_acting_rank(pgid.pgid, whoami) == 0;
+ pending_creates_from_osd.emplace(pgid.pgid, is_primary);
}
dout(5) << __func__ << " withhold creation of pg " << pgid
<< ": " << pg_map.size() << " >= "<< max_pgs_per_osd << dendl;
pgtemp = new MOSDPGTemp{osdmap->get_epoch()};
}
vector<int> acting;
- osdmap->pg_to_up_acting_osds(*pg, nullptr, nullptr, &acting, nullptr);
- pgtemp->pg_temp[*pg] = twiddle(acting);
+ osdmap->pg_to_up_acting_osds(pg->first, nullptr, nullptr, &acting, nullptr);
+ pgtemp->pg_temp[pg->first] = twiddle(acting);
pg = pending_creates_from_osd.erase(pg);
spare_pgs--;
}
[[gnu::unused]] auto&& pending_create_locker = guardedly_lock(pending_creates_lock);
for (auto pg = pending_creates_from_osd.cbegin();
pg != pending_creates_from_osd.cend();) {
- if (osdmap->get_pg_acting_rank(*pg, whoami) < 0) {
+ if (osdmap->get_pg_acting_rank(pg->first, whoami) < 0) {
pg = pending_creates_from_osd.erase(pg);
} else {
++pg;
ceph::unordered_map<spg_t, PG*> pg_map; // protected by pg_map lock
std::mutex pending_creates_lock;
- std::set<pg_t> pending_creates_from_osd;
+ using create_from_osd_t = std::pair<pg_t, bool /* is primary*/>;
+ std::set<create_from_osd_t> pending_creates_from_osd;
unsigned pending_creates_from_mon = 0;
map<spg_t, list<PG::CephPeeringEvtRef> > peering_wait_for_split;