]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD: only trim up to the oldest map still in use by a pg
authorSamuel Just <sam.just@inktank.com>
Fri, 11 Jan 2013 19:02:15 +0000 (11:02 -0800)
committerSamuel Just <sam.just@inktank.com>
Fri, 11 Jan 2013 20:17:10 +0000 (12:17 -0800)
map_cache.cached_lb() provides us with a lower bound across
all pgs for in-use osdmaps.  We cannot trim past this since
those maps are still in use.

backport: bobtail
Fixes: #3770
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
src/common/shared_cache.hpp
src/osd/OSD.cc

index 9f912df61f09c5d18602e06a747b6625cae87c83..1bbfa0e354f2db9ea6b6a40be3f2ee1263c214f0 100644 (file)
@@ -88,6 +88,12 @@ public:
     }
   }
 
+  // Returns K key s.t. key <= k for all currently cached k,v
+  K cached_key_lower_bound() {
+    Mutex::Locker l(lock);
+    return weak_refs.begin()->first;
+  }
+
   VPtr lower_bound(K key) {
     VPtr val;
     list<VPtr> to_release;
index a0bcecabf9ed6026e93ba5ea2867045abddc7dc0..a20e251f21e8b88b33538682851df33319c76c17 100644 (file)
@@ -3830,7 +3830,10 @@ void OSD::handle_osd_map(MOSDMap *m)
 
   if (superblock.oldest_map) {
     int num = 0;
-    for (epoch_t e = superblock.oldest_map; e < m->oldest_map; ++e) {
+    epoch_t min(
+      MIN(m->oldest_map,
+         service.map_cache.cached_key_lower_bound()));
+    for (epoch_t e = superblock.oldest_map; e < min; ++e) {
       dout(20) << " removing old osdmap epoch " << e << dendl;
       t.remove(coll_t::META_COLL, get_osdmap_pobject_name(e));
       t.remove(coll_t::META_COLL, get_inc_osdmap_pobject_name(e));