dout(10) << "create_pending e " << pending_inc.epoch << dendl;
- // clean up pg_temp, primary_temp
- OSDMap::clean_temps(cct, osdmap, &pending_inc);
- dout(10) << "create_pending did clean_temps" << dendl;
-
// safety checks (this shouldn't really happen)
{
if (osdmap.backfillfull_ratio <= 0) {
tmp.deepish_copy_from(osdmap);
tmp.apply_incremental(pending_inc);
+ // clean pg_temp mappings
+ OSDMap::clean_temps(cct, osdmap, tmp, &pending_inc);
+
+ // clean inappropriate pg_upmap/pg_upmap_items (if any)
+ osdmap.maybe_remove_pg_upmaps(cct, osdmap, tmp, &pending_inc);
+
// update creating pgs first so that we can remove the created pgid and
// process the pool flag removal below in the same osdmap epoch.
auto pending_creatings = update_pending_pgs(pending_inc, tmp);
}
}
- // clean inappropriate pg_upmap/pg_upmap_items (if any)
- osdmap.maybe_remove_pg_upmaps(cct, osdmap, &pending_inc);
-
// features for osdmap and its incremental
uint64_t features;
}
void OSDMap::clean_temps(CephContext *cct,
- const OSDMap& osdmap, Incremental *pending_inc)
+ const OSDMap& oldmap,
+ const OSDMap& tmpmap,
+ Incremental *pending_inc)
{
ldout(cct, 10) << __func__ << dendl;
- OSDMap tmpmap;
- tmpmap.deepish_copy_from(osdmap);
- tmpmap.apply_incremental(*pending_inc);
for (auto pg : *tmpmap.pg_temp) {
// if pool does not exist, remove any existing pg_temps associated with
// it. we don't care about pg_temps on the pending_inc either; if there
// are new_pg_temp entries on the pending, clear them out just as well.
- if (!osdmap.have_pg_pool(pg.first.pool())) {
+ if (!tmpmap.have_pg_pool(pg.first.pool())) {
ldout(cct, 10) << __func__ << " removing pg_temp " << pg.first
<< " for nonexistent pool " << pg.first.pool() << dendl;
pending_inc->new_pg_temp[pg.first].clear();
if (raw_up == pg.second) {
ldout(cct, 10) << __func__ << " removing pg_temp " << pg.first << " "
<< pg.second << " that matches raw_up mapping" << dendl;
- if (osdmap.pg_temp->count(pg.first))
+ if (oldmap.pg_temp->count(pg.first))
pending_inc->new_pg_temp[pg.first].clear();
else
pending_inc->new_pg_temp.erase(pg.first);
ldout(cct, 10) << __func__ << " removing primary_temp "
<< pgid << " -> " << real_primary
<< " (unnecessary/redundant)" << dendl;
- if (osdmap.primary_temp->count(pgid))
+ if (oldmap.primary_temp->count(pgid))
pending_inc->new_primary_temp[pgid] = -1;
else
pending_inc->new_primary_temp.erase(pgid);
}
void OSDMap::maybe_remove_pg_upmaps(CephContext *cct,
- const OSDMap& osdmap,
+ const OSDMap& oldmap,
+ const OSDMap& tmpmap,
Incremental *pending_inc)
{
ldout(cct, 10) << __func__ << dendl;
- OSDMap tmpmap;
- tmpmap.deepish_copy_from(osdmap);
- tmpmap.apply_incremental(*pending_inc);
set<pg_t> to_check;
set<pg_t> to_cancel;
map<int, map<int, float>> rule_weight_map;
<< dendl;
pending_inc->new_pg_upmap.erase(it);
}
- if (osdmap.pg_upmap.count(pg)) {
+ if (oldmap.pg_upmap.count(pg)) {
ldout(cct, 10) << __func__ << " cancel invalid pg_upmap entry "
- << osdmap.pg_upmap.find(pg)->first << "->"
- << osdmap.pg_upmap.find(pg)->second
+ << oldmap.pg_upmap.find(pg)->first << "->"
+ << oldmap.pg_upmap.find(pg)->second
<< dendl;
pending_inc->old_pg_upmap.insert(pg);
}
<< dendl;
pending_inc->new_pg_upmap_items.erase(it);
}
- if (osdmap.pg_upmap_items.count(pg)) {
+ if (oldmap.pg_upmap_items.count(pg)) {
ldout(cct, 10) << __func__ << " cancel invalid "
<< "pg_upmap_items entry "
- << osdmap.pg_upmap_items.find(pg)->first << "->"
- << osdmap.pg_upmap_items.find(pg)->second
+ << oldmap.pg_upmap_items.find(pg)->first << "->"
+ << oldmap.pg_upmap_items.find(pg)->second
<< dendl;
pending_inc->old_pg_upmap_items.insert(pg);
}
uint64_t get_up_osd_features() const;
void maybe_remove_pg_upmaps(CephContext *cct,
- const OSDMap& osdmap,
+ const OSDMap& oldmap,
+ const OSDMap& nextmap,
Incremental *pending_inc);
int apply_incremental(const Incremental &inc);
/// try to re-use/reference addrs in oldmap from newmap
static void dedup(const OSDMap *oldmap, OSDMap *newmap);
- static void clean_temps(CephContext *cct, const OSDMap& osdmap,
+ static void clean_temps(CephContext *cct,
+ const OSDMap& oldmap,
+ const OSDMap& nextmap,
Incremental *pending_inc);
// serialize, unserialize
osdmap.apply_incremental(pgtemp_map);
- OSDMap::clean_temps(g_ceph_context, osdmap, &pending_inc);
+ OSDMap tmpmap;
+ tmpmap.deepish_copy_from(osdmap);
+ tmpmap.apply_incremental(pending_inc);
+ OSDMap::clean_temps(g_ceph_context, osdmap, tmpmap, &pending_inc);
EXPECT_TRUE(pending_inc.new_pg_temp.count(pga) &&
pending_inc.new_pg_temp[pga].size() == 0);
OSDMap::Incremental pending_inc(osdmap.get_epoch() + 1);
- OSDMap::clean_temps(g_ceph_context, osdmap, &pending_inc);
+ OSDMap tmpmap;
+ tmpmap.deepish_copy_from(osdmap);
+ tmpmap.apply_incremental(pending_inc);
+ OSDMap::clean_temps(g_ceph_context, osdmap, tmpmap, &pending_inc);
EXPECT_FALSE(pending_inc.new_pg_temp.count(pgid));
EXPECT_FALSE(pending_inc.new_primary_temp.count(pgid));
}
{
// STEP-2: apply cure
OSDMap::Incremental pending_inc(osdmap.get_epoch() + 1);
- osdmap.maybe_remove_pg_upmaps(g_ceph_context, osdmap, &pending_inc);
+ OSDMap tmpmap;
+ tmpmap.deepish_copy_from(osdmap);
+ tmpmap.apply_incremental(pending_inc);
+ osdmap.maybe_remove_pg_upmaps(g_ceph_context, osdmap, tmpmap, &pending_inc);
osdmap.apply_incremental(pending_inc);
{
// validate pg_upmap is gone (reverted)
{
// STEP-4: apply cure
OSDMap::Incremental pending_inc(osdmap.get_epoch() + 1);
- osdmap.maybe_remove_pg_upmaps(g_ceph_context, osdmap, &pending_inc);
+ OSDMap tmpmap;
+ tmpmap.deepish_copy_from(osdmap);
+ tmpmap.apply_incremental(pending_inc);
+ osdmap.maybe_remove_pg_upmaps(g_ceph_context, osdmap, tmpmap,
+ &pending_inc);
osdmap.apply_incremental(pending_inc);
{
// validate pg_upmap_items is gone (reverted)