]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: add osd_inject_bad_map_crc_probability option
authorSage Weil <sage@redhat.com>
Mon, 27 Oct 2014 21:25:54 +0000 (14:25 -0700)
committerSage Weil <sage@redhat.com>
Fri, 12 Dec 2014 19:08:40 +0000 (11:08 -0800)
Signed-off-by: Sage Weil <sage@redhat.com>
src/common/config_opts.h
src/osd/OSD.cc

index be9cb1311a8d1b39b21ae0fb28796abfe82d4eb2..bf0365077a6db028a69b6bec4282cf701fc7a140 100644 (file)
@@ -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)
index 023529c63736d04c2907b526f27f2129b6a73061..9f202869b054d089f331cc5465d4a40a27b1bbbe 100644 (file)
@@ -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;