]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/PGMap: only recalculate min_last_epoch_clean if incremental touches old min 1462/head
authorSage Weil <sage@inktank.com>
Sat, 22 Feb 2014 17:35:27 +0000 (09:35 -0800)
committerSage Weil <sage@inktank.com>
Fri, 14 Mar 2014 20:20:53 +0000 (13:20 -0700)
If the Incremental updates a value that used to equal the old min, we may
have raised it and need to recalculate it at the end.  Otherwise, we can
avoid recalculating at all!

Signed-off-by: Sage Weil <sage@inktank.com>
src/mon/PGMap.cc

index 72a60d9ac249e6435f5ed78e47fed439862aebd1..4eb70fe3beadff59dfc1401f55c63aaffdd1200b 100644 (file)
@@ -207,7 +207,20 @@ void PGMap::apply_incremental(CephContext *cct, const Incremental& inc)
     if (t == pg_stat.end()) {
       ceph::unordered_map<pg_t,pg_stat_t>::value_type v(update_pg, update_stat);
       pg_stat.insert(v);
+      // did we affect the min?
+      if (min_last_epoch_clean &&
+         update_stat.get_effective_last_epoch_clean() < min_last_epoch_clean)
+       min_last_epoch_clean = 0;
     } else {
+      // did we (or might we) affect the min?
+      epoch_t lec = update_stat.get_effective_last_epoch_clean();
+      if (min_last_epoch_clean &&
+         (lec < min_last_epoch_clean ||  // we did
+          (lec > min_last_epoch_clean && // we might
+           t->second.get_effective_last_epoch_clean() == min_last_epoch_clean)
+          ))
+       min_last_epoch_clean = 0;
+
       stat_pg_sub(update_pg, t->second);
       t->second = update_stat;
     }
@@ -229,9 +242,22 @@ void PGMap::apply_incremental(CephContext *cct, const Incremental& inc)
       stat_osd_sub(t->second);
       t->second = new_stats;
     }
+    ceph::unordered_map<int32_t,epoch_t>::iterator i = osd_epochs.find(osd);
     map<int32_t,epoch_t>::const_iterator j = inc.get_osd_epochs().find(osd);
     assert(j != inc.get_osd_epochs().end());
-    osd_epochs[j->first] = j->second;
+
+    // will we potentially affect the min?
+    if (min_last_epoch_clean &&
+       (i == osd_epochs.end() ||
+        j->second < min_last_epoch_clean ||
+        (j->second > min_last_epoch_clean &&
+         i->second == min_last_epoch_clean)))
+      min_last_epoch_clean = 0;
+
+    if (i == osd_epochs.end())
+      osd_epochs.insert(*j);
+    else
+      i->second = j->second;
 
     stat_osd_add(new_stats);