]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: avoid generate huge osdmap deletion transactions
authorSage Weil <sage@inktank.com>
Thu, 16 Aug 2012 20:38:54 +0000 (13:38 -0700)
committerSage Weil <sage@inktank.com>
Thu, 16 Aug 2012 20:38:54 +0000 (13:38 -0700)
Cap the number of maps we delete on each pass through handle_osd_map.  As
long as the target transaction size is larger than the number of maps we
get in each message, we'll be fine.  Ensure we at least keep pace with
incoming maps in case those values' relative sizes nave flipped.

Fixes: #2856
Signed-off-by: Sage Weil <sage@inktank.com>
src/osd/OSD.cc

index ed4e61f4c2b9db42063ec210db547cb57acedcf6..786558ae6c1bc1a2c264756029d7ef1d8141c659 100644 (file)
@@ -3519,11 +3519,16 @@ 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) {
       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));
       superblock.oldest_map = e+1;
+      num++;
+      if (num >= g_conf->osd_target_transaction_size &&
+         num > (last - first))  // make sure we at least keep pace with incoming maps
+       break;
     }
   }