]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/PGMap: invalidate cached min_last_epoch_clean from new-style pg keys
authorSage Weil <sage@redhat.com>
Sun, 2 Nov 2014 16:49:48 +0000 (08:49 -0800)
committerJoao Eduardo Luis <joao@redhat.com>
Mon, 15 Dec 2014 16:18:50 +0000 (16:18 +0000)
We were only invalidating the cache from the legacy apply_incremental(),
which is no longer called on modern clusters.

Fixes: #9987
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 3fb731b722c50672a5a9de0c86a621f5f50f2d06)

src/mon/PGMap.cc

index b7a0a4e9ef7705ff245b676106f7eefa97c68a13..b7acb86bf2e1258ee7d2d9cfc62a0d3233560b24 100644 (file)
@@ -379,17 +379,31 @@ void PGMap::update_pg(pg_t pgid, bufferlist& bl)
 {
   bufferlist::iterator p = bl.begin();
   ceph::unordered_map<pg_t,pg_stat_t>::iterator s = pg_stat.find(pgid);
-  if (s != pg_stat.end())
+  epoch_t old_lec = 0;
+  if (s != pg_stat.end()) {
+    old_lec = s->second.get_effective_last_epoch_clean();
     stat_pg_sub(pgid, s->second);
+  }
   pg_stat_t& r = pg_stat[pgid];
   ::decode(r, p);
   stat_pg_add(pgid, r);
+
+  epoch_t lec = r.get_effective_last_epoch_clean();
+  if (min_last_epoch_clean &&
+      (lec < min_last_epoch_clean ||  // we did
+       (lec > min_last_epoch_clean && // we might
+       old_lec == min_last_epoch_clean)
+       ))
+    min_last_epoch_clean = 0;
 }
 
 void PGMap::remove_pg(pg_t pgid)
 {
   ceph::unordered_map<pg_t,pg_stat_t>::iterator s = pg_stat.find(pgid);
   if (s != pg_stat.end()) {
+    if (min_last_epoch_clean &&
+       s->second.get_effective_last_epoch_clean() == min_last_epoch_clean)
+      min_last_epoch_clean = 0;
     stat_pg_sub(pgid, s->second);
     pg_stat.erase(s);
   }