]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/PGMap and PGMonitor: update last_epoch_clean cache from new osd keys 3220/head
authorSage Weil <sage@redhat.com>
Sun, 2 Nov 2014 16:50:59 +0000 (08:50 -0800)
committerJoao Eduardo Luis <joao@redhat.com>
Wed, 17 Dec 2014 17:13:57 +0000 (17:13 +0000)
We were only invalidating the cached value from apply_incremental, which
is no longer called on modern clusters.

Fix this by storing the update epoch in the key as well (it is not part
of osd_stat_t).

Backport: giant, firefly, dumpling(?)
Fixes: #9987
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 093c5f0cabeb552b90d944da2c50de48fcf6f564)

src/mon/PGMap.cc
src/mon/PGMonitor.cc

index d66c92be153548bc89d0a1195f0d4788370d6279..59b6a032f083fb6041eb8dda6b5acc84bee72b77 100644 (file)
@@ -413,14 +413,33 @@ void PGMap::update_osd(int osd, bufferlist& bl)
 {
   bufferlist::iterator p = bl.begin();
   ceph::unordered_map<int32_t,osd_stat_t>::iterator o = osd_stat.find(osd);
-  if (o != osd_stat.end())
+  epoch_t old_lec = 0;
+  if (o != osd_stat.end()) {
+    ceph::unordered_map<int32_t,epoch_t>::iterator i = osd_epochs.find(osd);
+    if (i != osd_epochs.end())
+      old_lec = i->second;
     stat_osd_sub(o->second);
+  }
   osd_stat_t& r = osd_stat[osd];
   ::decode(r, p);
   stat_osd_add(r);
 
   // adjust [near]full status
   register_nearfull_status(osd, r);
+
+  // epoch?
+  if (!p.end()) {
+    epoch_t e;
+    ::decode(e, p);
+
+    if (e < min_last_epoch_clean ||
+       (e > min_last_epoch_clean &&
+        old_lec == min_last_epoch_clean))
+      min_last_epoch_clean = 0;
+  } else {
+    // WARNING: we are not refreshing min_last_epoch_clean!  must be old store
+    // or old mon running.
+  }
 }
 
 void PGMap::remove_osd(int osd)
index 15f67466e3efe53525d63e8495eb939fb9066913..364ad20cfc106c6f63971aff7e00ada7b47a39ef 100644 (file)
@@ -545,6 +545,7 @@ void PGMonitor::encode_pending(MonitorDBStore::Transaction *t)
       ::encode(p->first, dirty);
       bufferlist bl;
       ::encode(p->second, bl, features);
+      ::encode(pending_inc.get_osd_epochs().find(p->first)->second, bl);
       t->put(prefix, stringify(p->first), bl);
     }
     for (set<int32_t>::const_iterator p =