]> git.apps.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>
Wed, 17 Dec 2014 17:13:57 +0000 (17:13 +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 5ec8ee2a97be1c3933e785a86e8aeb11bbeb00cc..d66c92be153548bc89d0a1195f0d4788370d6279 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);
   }