]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: limit number of inc osdmaps send to peers, clients
authorSage Weil <sage@inktank.com>
Wed, 10 Jul 2013 18:02:08 +0000 (11:02 -0700)
committerSage Weil <sage@inktank.com>
Wed, 10 Jul 2013 18:02:08 +0000 (11:02 -0700)
We should not send an unbounded number of inc maps to our peers or clients.
In particular, if a peer is not contacted for a while, we may think they
have a very old map (say, 10000 epochs ago) and send thousands of inc maps
when the distribution shifts and we need to peer.

Note that if we do not send enough maps, the peers will make do by
requesting the map from somewhere else (currently the mon).  Regardless
of the source, however, we must limit the amount that we speculatively
share as it usually is not needed.

Backport: cuttlefish, bobtail
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Samuel Just <sam.just@inktank.com>
src/common/config_opts.h
src/osd/OSD.cc

index 01ec8375cd2904b0cc35e92968e8f4636f661b5b..016c08204c4919ba15ab7a1ab4963082cd2f39c5 100644 (file)
@@ -390,6 +390,7 @@ OPTION(osd_pool_default_flag_hashpspool, OPT_BOOL, true)
 OPTION(osd_map_dedup, OPT_BOOL, true)
 OPTION(osd_map_cache_size, OPT_INT, 500)
 OPTION(osd_map_message_max, OPT_INT, 100)  // max maps per MOSDMap message
+OPTION(osd_map_share_max_epochs, OPT_INT, 100)  // cap on # of inc maps we send to peers, clients
 OPTION(osd_op_threads, OPT_INT, 2)    // 0 == no threading
 OPTION(osd_op_pq_max_tokens_per_priority, OPT_U64, 4194304)
 OPTION(osd_op_pq_min_cost, OPT_U64, 65536)
index c4efbc3485ddb9fd0f6a8ad6968793c361fad81b..c6f92ecbf096a7471382a1d864b1e28bb098d044 100644 (file)
@@ -5395,7 +5395,8 @@ void OSD::send_map(MOSDMap *m, Connection *con)
 
 void OSD::send_incremental_map(epoch_t since, Connection *con)
 {
-  dout(10) << "send_incremental_map " << since << " -> " << osdmap->get_epoch()
+  epoch_t to = osdmap->get_epoch();
+  dout(10) << "send_incremental_map " << since << " -> " << to
            << " to " << con << " " << con->get_peer_addr() << dendl;
 
   if (since < superblock.oldest_map) {
@@ -5403,14 +5404,18 @@ void OSD::send_incremental_map(epoch_t since, Connection *con)
     MOSDMap *m = new MOSDMap(monc->get_fsid());
     m->oldest_map = superblock.oldest_map;
     m->newest_map = superblock.newest_map;
-    epoch_t e = osdmap->get_epoch();
-    get_map_bl(e, m->maps[e]);
+    get_map_bl(to, m->maps[to]);
     send_map(m, con);
     return;
   }
 
-  while (since < osdmap->get_epoch()) {
-    epoch_t to = osdmap->get_epoch();
+  if (to > since && to - since > g_conf->osd_map_share_max_epochs) {
+    dout(10) << "  " << (to - since) << " > max " << g_conf->osd_map_share_max_epochs
+            << ", only sending most recent" << dendl;
+    since = to - g_conf->osd_map_share_max_epochs;
+  }
+
+  while (since < to) {
     if (to - since > (epoch_t)g_conf->osd_map_message_max)
       to = since + g_conf->osd_map_message_max;
     MOSDMap *m = build_incremental_map_msg(since, to);