From: Kefu Chai Date: Fri, 14 Apr 2017 07:49:14 +0000 (+0800) Subject: mon/OSDMonitor: transit creating_pgs from pgmap when upgrading X-Git-Tag: v12.0.2~66^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F14551%2Fhead;p=ceph.git mon/OSDMonitor: transit creating_pgs from pgmap when upgrading there could be some pg(s) still being created when we are upgrading to luminous, and the pools holding them are not changed in the sense of pg_pool_t::last_change after the upgrade and before we scan for creating pgs. in that case, the existing update_pending_creatings() will fail to collect the pgs being created before the upgrade. with this change, the creating_pgs in pgmap are also used for updating the OSDMonitor's creating_pgs if it's updated. but we should stopupdating the pgmap once the upgrade completes. i.e. stop dispatching MSG_PGSTATS messages to PGMonitor if the quorum and all osds are luminous. Fixes: http://tracker.ceph.com/issues/19584 Signed-off-by: Kefu Chai --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index a1540cd48e4a..4e75d6a3c0f9 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -824,6 +824,19 @@ OSDMonitor::update_pending_creatings(const OSDMap::Incremental& inc) pending_creatings.created_pools.insert(pg.pool()); pending_creatings.pgs.erase(pg); } + // PAXOS_PGMAP is less than PAXOS_OSDMAP, so PGMonitor::update_from_paxos() + // should have prepared the latest pgmap if any + const auto& pgm = mon->pgmon()->pg_map; + if (pgm.last_pg_scan >= creating_pgs.last_scan_epoch) { + // TODO: please stop updating pgmap with pgstats once the upgrade is completed + 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 + creating_pgs.pgs.emplace(pgid, created); + } + } for (auto old_pool : inc.old_pools) { pending_creatings.created_pools.erase(old_pool); const auto removed_pool = (uint64_t)old_pool;