]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: add 'osd debug drop op probability'
authorSage Weil <sage@inktank.com>
Mon, 22 Oct 2012 18:29:38 +0000 (11:29 -0700)
committerSage Weil <sage@inktank.com>
Mon, 12 Nov 2012 20:04:34 +0000 (12:04 -0800)
This is meant to exercise the kclient's timeout and osd reconnect logic
by dropping some client requests on the floor.

Signed-off-by: Sage Weil <sage@inktank.com>
src/common/config_opts.h
src/osd/OSD.cc

index 1a93064f6618332c4c0bc7d62ee52eff1f9cc081..cbaab0978742a09a1fd02130c11f448842882415 100644 (file)
@@ -361,6 +361,7 @@ OPTION(osd_debug_drop_ping_probability, OPT_DOUBLE, 0)
 OPTION(osd_debug_drop_ping_duration, OPT_INT, 0)
 OPTION(osd_debug_drop_pg_create_probability, OPT_DOUBLE, 0)
 OPTION(osd_debug_drop_pg_create_duration, OPT_INT, 1)
+OPTION(osd_debug_drop_op_probability, OPT_DOUBLE, 0)   // probability of stalling/dropping a client op
 OPTION(osd_op_history_size, OPT_U32, 20)    // Max number of completed ops to track
 OPTION(osd_op_history_duration, OPT_U32, 600) // Oldest completed op to track
 OPTION(osd_target_transaction_size, OPT_INT, 300)     // to adjust various transactions that batch smaller items
index 8ff5c659d5c1408a26f0f861728b6a729a3d5785..66a55863a52987c272f74d55be4697ed2a00fcdd 100644 (file)
@@ -5442,6 +5442,14 @@ void OSD::handle_op(OpRequestRef op)
     return;
   }
 
+  if (g_conf->osd_debug_drop_op_probability > 0 &&
+      !m->get_source().is_mds()) {
+    if ((double)rand() / (double)RAND_MAX < g_conf->osd_debug_drop_op_probability) {
+      dout(0) << "handle_op DEBUG artificially dropping op " << *m << dendl;
+      return;
+    }
+  }
+
   if (m->may_write()) {
     // full?
     if (osdmap->test_flag(CEPH_OSDMAP_FULL) &&