]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: Monitor: inject scrub failures
authorJoao Eduardo Luis <joao@suse.de>
Mon, 20 Apr 2015 22:37:57 +0000 (23:37 +0100)
committerJoao Eduardo Luis <joao@suse.de>
Wed, 27 May 2015 22:48:45 +0000 (23:48 +0100)
Signed-off-by: Joao Eduardo Luis <joao@suse.de>
src/common/config_opts.h
src/mon/Monitor.cc

index ee08e0ea78b652f97100588ae6820729a5320690..828919f9161e7b7e379fcb8257247c2d25a7798d 100644 (file)
@@ -245,6 +245,7 @@ OPTION(mon_data_avail_warn, OPT_INT, 30)
 OPTION(mon_data_size_warn, OPT_U64, 15*1024*1024*1024) // issue a warning when the monitor's data store goes over 15GB (in bytes)
 OPTION(mon_scrub_interval, OPT_INT, 3600*24) // once a day
 OPTION(mon_scrub_max_keys, OPT_INT, 100) // max number of keys to scrub each time
+OPTION(mon_scrub_inject_crc_mismatch, OPT_DOUBLE, 0.0) // probability of injected crc mismatch [0.0, 1.0]
 OPTION(mon_config_key_max_entry_size, OPT_INT, 4096) // max num bytes per config-key entry
 OPTION(mon_sync_timeout, OPT_DOUBLE, 60.0)
 OPTION(mon_sync_max_payload_size, OPT_U32, 1048576) // max size for a sync chunk payload (say, 1MB)
index a5e623d04bbb83eb712303cd97f6a1272027e866..ddf87acbd07248c09e69e49f68987ede3d24de61 100644 (file)
@@ -4339,6 +4339,12 @@ bool Monitor::_scrub(ScrubResult *r,
       r->prefix_crc[k.first] = 0;
     r->prefix_crc[k.first] = bl.crc32c(r->prefix_crc[k.first]);
 
+    if (cct->_conf->mon_scrub_inject_crc_mismatch > 0.0 &&
+        (rand() % 10000 < cct->_conf->mon_scrub_inject_crc_mismatch*10000.0)) {
+      dout(10) << __func__ << " inject failure at (" << k << ")" << dendl;
+      r->prefix_crc[k.first] += 1;
+    }
+
     ++scrubbed_keys;
     last_key = k;
   }