From: Kefu Chai Date: Mon, 27 Mar 2017 03:12:09 +0000 (+0800) Subject: mon: switch to osdmon when handling osd_pg_creates subs X-Git-Tag: v12.0.2~256^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9331cedd96fa11d573d0fb17b126ad5e081f61d2;p=ceph.git mon: switch to osdmon when handling osd_pg_creates subs Signed-off-by: Kefu Chai --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 0aa20090eaf1..fd737fef60f5 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -1177,8 +1177,16 @@ void OSDMonitor::prime_pg_temp( const OSDMap& next, pg_t pgid) { - if (!creating_pgs.pgs.count(pgid)) { - return; + if (mon->monmap->get_required_features().contains_all( + ceph::features::mon::FEATURE_LUMINOUS)) { + if (!creating_pgs.pgs.count(pgid)) { + return; + } + } else { + const auto& pg_map = mon->pgmon()->pg_map; + if (!pg_map.creating_pgs.count(pgid)) { + return; + } } vector up, acting; @@ -1467,13 +1475,23 @@ void OSDMonitor::share_map_with_random_osd() version_t OSDMonitor::get_trim_to() { - { + if (mon->monmap->get_required_features().contains_all( + ceph::features::mon::FEATURE_LUMINOUS)) { std::lock_guard l(creating_pgs_lock); if (!creating_pgs.pgs.empty()) { return 0; } + if (!mon->pgmon()->is_readable()) { + return 0; + } + } else { + if (!mon->pgmon()->is_readable()) + return 0; + if (mon->pgmon()->pg_map.creating_pgs.empty()) { + return 0; + } } - if (mon->pgmon()->is_readable()) { + { epoch_t floor = mon->pgmon()->pg_map.get_min_last_epoch_clean(); dout(10) << " min_last_epoch_clean " << floor << dendl; if (g_conf->mon_osd_force_trim_to > 0 && diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index e360303c8110..617ab1a1878f 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -1936,16 +1936,18 @@ void PGMonitor::check_subs() }); } -void PGMonitor::check_sub(Subscription *sub) +bool PGMonitor::check_sub(Subscription *sub) { + OSDMap& osdmap = mon->osdmon()->osdmap; if (sub->type == "osd_pg_creates") { // only send these if the OSD is up. we will check_subs() when they do // come up so they will get the creates then. if (sub->session->inst.name.is_osd() && - mon->osdmon()->osdmap.is_up(sub->session->inst.name.num())) { + osdmap.is_up(sub->session->inst.name.num())) { sub->next = send_pg_creates(sub->session->inst.name.num(), sub->session->con.get(), sub->next); } } + return true; } diff --git a/src/mon/PGMonitor.h b/src/mon/PGMonitor.h index c1eaa2b612da..dd53b6fe2f53 100644 --- a/src/mon/PGMonitor.h +++ b/src/mon/PGMonitor.h @@ -147,7 +147,7 @@ public: const set& s, const char *desc, health_status_t sev) const; void check_subs(); - void check_sub(Subscription *sub); + bool check_sub(Subscription *sub); private: // no copying allowed