]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/ClusterState: discard pg updates for pgs >= pg_num
authorSage Weil <sage@redhat.com>
Mon, 30 Jul 2018 03:23:06 +0000 (22:23 -0500)
committerSage Weil <sage@redhat.com>
Fri, 7 Sep 2018 17:08:40 +0000 (12:08 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/mgr/ClusterState.cc
src/mgr/ClusterState.h

index d9eed6d4dfbabae179e634690478259d428eb172..436b53f8f9d4b120dd6c76f60acfb6fe34f33058 100644 (file)
@@ -78,7 +78,8 @@ void ClusterState::ingest_pgstats(MPGStats *stats)
 
     // In case we're hearing about a PG that according to last
     // OSDMap update should not exist
-    if (existing_pools.count(pgid.pool()) == 0) {
+    auto r = existing_pools.find(pgid.pool());
+    if (r == existing_pools.end()) {
       dout(15) << " got " << pgid
               << " reported at " << pg_stats.reported_epoch << ":"
                << pg_stats.reported_seq
@@ -87,6 +88,15 @@ void ClusterState::ingest_pgstats(MPGStats *stats)
                << dendl;
       continue;
     }
+    if (pgid.ps() >= r->second) {
+      dout(15) << " got " << pgid
+              << " reported at " << pg_stats.reported_epoch << ":"
+               << pg_stats.reported_seq
+               << " state " << pg_state_string(pg_stats.state)
+               << " but > pg_num " << r->second
+               << dendl;
+      continue;
+    }
     // In case we already heard about more recent stats from this PG
     // from another OSD
     const auto q = pg_map.pg_stat.find(pgid);
@@ -94,7 +104,7 @@ void ClusterState::ingest_pgstats(MPGStats *stats)
        q->second.get_version_pair() > pg_stats.get_version_pair()) {
       dout(15) << " had " << pgid << " from "
               << q->second.reported_epoch << ":"
-               << q->second.reported_seq << dendl;
+              << q->second.reported_seq << dendl;
       continue;
     }
 
@@ -137,7 +147,7 @@ void ClusterState::notify_osdmap(const OSDMap &osd_map)
   // in synchrony with this OSDMap.
   existing_pools.clear();
   for (auto& p : osd_map.get_pools()) {
-    existing_pools.insert(p.first);
+    existing_pools[p.first] = p.second.get_pg_num();
   }
 
   // brute force this for now (don't bother being clever by only
index d0ec594cc40fc4a65bf6375b2d6a11e11dc9cee0..a22c058dec74066c2fbf943e1ebd2836549b698c 100644 (file)
@@ -43,7 +43,7 @@ protected:
 
   MgrMap mgr_map;
 
-  set<int64_t> existing_pools; ///< pools that exist, as of PGMap epoch
+  map<int64_t,unsigned> existing_pools; ///< pools that exist, and pg_num, as of PGMap epoch
   PGMap pg_map;
   PGMap::Incremental pending_inc;