}
auto q = pg_map.num_pg_by_osd.find(osd);
if (q != pg_map.num_pg_by_osd.end()) {
- if (q->second.acting > 0 || q->second.up > 0) {
+ if (q->second.acting > 0 || q->second.up_not_acting > 0) {
active_osds.insert(osd);
- affected_pgs += q->second.acting + q->second.up;
+ // XXX: For overlapping PGs, this counts them again
+ affected_pgs += q->second.acting + q->second.up_not_acting;
continue;
}
}
if (!r) {
ss << "OSD(s) " << osds << " are safe to destroy without reducing data"
<< " durability.";
- safe_to_destroy.swap(osds);
}
if (f) {
f->open_object_section("osd_status");
f->dump_unsigned("osd", p.first);
f->dump_unsigned("num_primary_pg", p.second.primary);
f->dump_unsigned("num_acting_pg", p.second.acting);
- f->dump_unsigned("num_up_pg", p.second.up);
+ f->dump_unsigned("num_up_not_acting_pg", p.second.up_not_acting);
f->close_section();
}
f->close_section();
num_pg_by_osd[*p].acting++;
}
for (auto p = s.up.begin(); p != s.up.end(); ++p) {
- pg_by_osd[*p].insert(pgid);
- num_pg_by_osd[*p].up++;
+ auto& t = pg_by_osd[*p];
+ if (t.find(pgid) == t.end()) {
+ t.insert(pgid);
+ num_pg_by_osd[*p].up_not_acting++;
+ }
}
if (s.up_primary >= 0) {
blocked_by_sum.erase(q);
}
+ set<int32_t> actingset;
for (auto p = s.acting.begin(); p != s.acting.end(); ++p) {
+ actingset.insert(*p);
auto& oset = pg_by_osd[*p];
oset.erase(pgid);
if (oset.empty())
oset.erase(pgid);
if (oset.empty())
pg_by_osd.erase(*p);
+ if (actingset.count(*p))
+ continue;
auto it = num_pg_by_osd.find(*p);
- if (it != num_pg_by_osd.end() && it->second.up > 0)
- it->second.up--;
+ if (it != num_pg_by_osd.end() && it->second.up_not_acting > 0)
+ it->second.up_not_acting--;
}
if (s.up_primary >= 0) {
mempool::pgmap::unordered_map<uint64_t,int32_t> num_pg_by_state;
struct pg_count {
int32_t acting = 0;
- int32_t up = 0;
+ int32_t up_not_acting = 0;
int32_t primary = 0;
void encode(bufferlist& bl) const {
using ceph::encode;
encode(acting, bl);
- encode(up, bl);
+ encode(up_not_acting, bl);
encode(primary, bl);
}
void decode(bufferlist::const_iterator& p) {
using ceph::decode;
decode(acting, p);
- decode(up, p);
+ decode(up_not_acting, p);
decode(primary, p);
}
};