summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-07-10 11:02:08 -0700
committerSage Weil <sage@inktank.com>2013-07-10 11:03:08 -0700
commit78f226634bd80f6678b1f74ccf785bc52fcd6b62 (patch)
tree4ea037b3559e3ad81ec23511c2ce6af416d54422
parent54ee2dc80ed032c286546da51442340ec9991cdf (diff)
downloadceph-78f226634bd80f6678b1f74ccf785bc52fcd6b62.tar.gz
osd: limit number of inc osdmaps send to peers, clients
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> (cherry picked from commit 653e04a79430317e275dd77a46c2b17c788b860b)
-rw-r--r--src/common/config_opts.h1
-rw-r--r--src/osd/OSD.cc15
2 files changed, 11 insertions, 5 deletions
diff --git a/src/common/config_opts.h b/src/common/config_opts.h
index b19d274eb2a..11da6c5bb21 100644
--- a/src/common/config_opts.h
+++ b/src/common/config_opts.h
@@ -385,6 +385,7 @@ OPTION(osd_pool_default_flags, OPT_INT, 0) // default flags for new pools
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)
diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc
index 7ed62c772e4..c604953d027 100644
--- a/src/osd/OSD.cc
+++ b/src/osd/OSD.cc
@@ -4728,7 +4728,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) {
@@ -4736,14 +4737,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);