<< j->first << " " << j->second
<< dendl;
to_cancel->push_back(pg);
- } else {
- //Josh--check partial no-op here.
+ } else if (newmap != j->second) {
+ // check partial no-op here.
ldout(cct, 10) << __func__ << " simplifying partially no-op pg_upmap_items "
<< j->first << " " << j->second
<< " -> " << newmap
s += ",purged_snapdirs";
if (f & CEPH_OSDMAP_PGLOG_HARDLIMIT)
s += ",pglog_hardlimit";
+ if (f & CEPH_OSDMAP_NOAUTOSCALE)
+ s += ",noautoscale";
if (s.length())
s.erase(0, 1);
return s;
map<uint64_t,set<pg_t>> acting_prims_by_osd;
pgs_by_osd = tmp_osd_map.get_pgs_by_osd(cct, pid, &prim_pgs_by_osd, &acting_prims_by_osd);
- // Transfer pgs into a map, `pgs_to_check`. This will tell us the total num_changes after all
- // calculations have been finalized.
- // Transfer osds into a set, `osds_to_check`.
- // This is to avoid poor runtime when we loop through the pgs and to set up
- // our call to calc_desired_primary_distribution.
+ // Construct information about the pgs and osds we will consider in new primary mappings,
+ // as well as a map of all pgs and their original primary osds.
map<pg_t,bool> prim_pgs_to_check;
vector<uint64_t> osds_to_check;
+ map<pg_t, uint64_t> orig_prims;
for (const auto & [osd, pgs] : prim_pgs_by_osd) {
osds_to_check.push_back(osd);
for (const auto & pg : pgs) {
prim_pgs_to_check.insert({pg, false});
+ orig_prims.insert({pg, osd});
}
}
prim_dist_scores[up_primary] -= 1;
// Update the mappings
- pending_inc->new_pg_upmap_primary[pg] = curr_best_osd;
tmp_osd_map.pg_upmap_primaries[pg] = curr_best_osd;
- prim_pgs_to_check[pg] = true; // mark that this pg changed mappings
+ if (curr_best_osd == orig_prims[pg]) {
+ pending_inc->new_pg_upmap_primary.erase(pg);
+ prim_pgs_to_check[pg] = false;
+ } else {
+ pending_inc->new_pg_upmap_primary[pg] = curr_best_osd;
+ prim_pgs_to_check[pg] = true; // mark that this pg changed mappings
+ }
curr_num_changes++;
}
ss.str(), 0);
}
}
+ // UNEQUAL_WEIGHT
+ if (stretch_mode_enabled) {
+ vector<int> subtrees;
+ crush->get_subtree_of_type(stretch_mode_bucket, &subtrees);
+ if (subtrees.size() != 2) {
+ stringstream ss;
+ ss << "Stretch mode buckets != 2";
+ checks->add("INCORRECT_NUM_BUCKETS_STRETCH_MODE", HEALTH_WARN, ss.str(), 0);
+ return;
+ }
+ int weight1 = crush->get_item_weight(subtrees[0]);
+ int weight2 = crush->get_item_weight(subtrees[1]);
+ stringstream ss;
+ if (weight1 != weight2) {
+ ss << "Stretch mode buckets have different weights!";
+ checks->add("UNEVEN_WEIGHTS_STRETCH_MODE", HEALTH_WARN, ss.str(), 0);
+ }
+ }
}
int OSDMap::parse_osd_id_list(const vector<string>& ls, set<int> *out,