]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: ignore and/or remove pgs that shouldn't exist 20399/head
authorSage Weil <sage@redhat.com>
Fri, 2 Feb 2018 18:07:58 +0000 (12:07 -0600)
committerNathan Cutler <ncutler@suse.com>
Mon, 12 Feb 2018 09:27:09 +0000 (10:27 +0100)
The update_creating_pgs() change is there mainly for clusters that already
have an invalid pg in the map; going forward they hopefully shouldn't
appear!

Fixes: https://tracker.ceph.com/issues/22847
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit cd013ed417c0317da0249c6360f16a26894c82a1)

Conflicts:
src/mon/OSDMonitor.cc (luminous does not have d0a477bfec5dec6d70bb5c7de918f8258b9116f6)

src/mon/OSDMonitor.cc
src/mon/OSDMonitor.h

index 5a0a91d8487b0a5720658a29c36e10c5c57dc741..20900280788c48dcea4d8338de6799181b71d650 100644 (file)
@@ -684,7 +684,8 @@ void OSDMonitor::create_pending()
 }
 
 creating_pgs_t
-OSDMonitor::update_pending_pgs(const OSDMap::Incremental& inc)
+OSDMonitor::update_pending_pgs(const OSDMap::Incremental& inc,
+                              const OSDMap& nextmap)
 {
   dout(10) << __func__ << dendl;
   creating_pgs_t pending_creatings;
@@ -735,6 +736,20 @@ OSDMonitor::update_pending_pgs(const OSDMap::Incremental& inc)
     pending_creatings.last_scan_epoch = osdmap.get_epoch();
   }
 
+  // filter out any pgs that shouldn't exist.
+  {
+    auto i = pending_creatings.pgs.begin();
+    while (i != pending_creatings.pgs.end()) {
+      if (!nextmap.pg_exists(i->first)) {
+       dout(10) << __func__ << " removing pg " << i->first
+                << " which should not exist" << dendl;
+       i = pending_creatings.pgs.erase(i);
+      } else {
+       ++i;
+      }
+    }
+  }
+
   // process queue
   unsigned max = MAX(1, g_conf->mon_osd_max_creating_pgs);
   const auto total = pending_creatings.pgs.size();
@@ -1373,7 +1388,7 @@ void OSDMonitor::encode_pending(MonitorDBStore::TransactionRef t)
   // and pg creating, also!
   if (mon->monmap->get_required_features().contains_all(
        ceph::features::mon::FEATURE_LUMINOUS)) {
-    auto pending_creatings = update_pending_pgs(pending_inc);
+    auto pending_creatings = update_pending_pgs(pending_inc, tmp);
     if (osdmap.get_epoch() &&
        osdmap.require_osd_release < CEPH_RELEASE_LUMINOUS) {
       dout(7) << __func__ << " in the middle of upgrading, "
@@ -3407,6 +3422,11 @@ void OSDMonitor::update_creating_pgs()
   for (const auto& pg : creating_pgs.pgs) {
     int acting_primary = -1;
     auto pgid = pg.first;
+    if (!osdmap.pg_exists(pgid)) {
+      dout(20) << __func__ << " ignoring " << pgid << " which should not exist"
+              << dendl;
+      continue;
+    }
     auto mapped = pg.second.first;
     dout(20) << __func__ << " looking up " << pgid << "@" << mapped << dendl;
     mapping.get(pgid, nullptr, nullptr, nullptr, &acting_primary);
index 9767f10035780898e1f6ac141e08791b22082e50..af6e01af9b38395db0ba8a424615ff9d4bc3bfaf 100644 (file)
@@ -453,7 +453,8 @@ protected:
   creating_pgs_t creating_pgs;
   mutable std::mutex creating_pgs_lock;
 
-  creating_pgs_t update_pending_pgs(const OSDMap::Incremental& inc);
+  creating_pgs_t update_pending_pgs(const OSDMap::Incremental& inc,
+                                   const OSDMap& nextmap);
   void trim_creating_pgs(creating_pgs_t *creating_pgs,
                         const ceph::unordered_map<pg_t,pg_stat_t>& pgm);
   unsigned scan_for_creating_pgs(