From: Sage Weil Date: Mon, 27 Oct 2014 21:25:54 +0000 (-0700) Subject: osd: add osd_inject_bad_map_crc_probability option X-Git-Tag: v0.91~55^2~2^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=32a837dd1e1f53ed78125ce01d7e957f43d76f1e;p=ceph.git osd: add osd_inject_bad_map_crc_probability option Signed-off-by: Sage Weil --- diff --git a/src/common/config_opts.h b/src/common/config_opts.h index be9cb1311a8d..bf0365077a6d 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -488,6 +488,7 @@ OPTION(osd_map_max_advance, OPT_INT, 200) // make this < cache_size! 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_inject_bad_map_crc_probability, OPT_FLOAT, 0) OPTION(osd_op_threads, OPT_INT, 2) // 0 == no threading OPTION(osd_peering_wq_batch_size, OPT_U64, 20) OPTION(osd_op_pq_max_tokens_per_priority, OPT_U64, 4194304) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 023529c63736..9f202869b054 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -6191,7 +6191,14 @@ void OSD::handle_osd_map(MOSDMap *m) bufferlist fbl; o->encode(fbl, inc.encode_features | CEPH_FEATURE_RESERVED); - if (o->get_crc() != inc.full_crc) { + bool injected_failure = false; + if (g_conf->osd_inject_bad_map_crc_probability > 0 && + (rand() % 10000) < g_conf->osd_inject_bad_map_crc_probability*10000.0) { + derr << __func__ << " injecting map crc failure" << dendl; + injected_failure = true; + } + + if (o->get_crc() != inc.full_crc || injected_failure) { dout(2) << "got incremental " << e << " but failed to encode full with correct crc; requesting" << dendl;