]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: transit creating_pgs from pgmap when upgrading 14551/head
authorKefu Chai <kchai@redhat.com>
Fri, 14 Apr 2017 07:49:14 +0000 (15:49 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 14 Apr 2017 08:45:23 +0000 (16:45 +0800)
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 <kchai@redhat.com>
src/mon/OSDMonitor.cc

index a1540cd48e4aeb585ba184cab355662917813035..4e75d6a3c0f930e9f172ca78e8cb87f45dd836dd 100644 (file)
@@ -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;