]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: add osd_debug_drop_pg_create_{probability,duration} options
authorSage Weil <sage@inktank.com>
Wed, 18 Jul 2012 19:20:24 +0000 (12:20 -0700)
committerSamuel Just <sam.just@inktank.com>
Wed, 18 Jul 2012 21:26:16 +0000 (14:26 -0700)
This will let us exercise more of the pg creation code.

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

index 32dcadf45dd8dc60e9727d8bbdfa71b4a79168a1..c93d21beb2e65a1928123dcdffea652e0c339c5e 100644 (file)
@@ -338,6 +338,8 @@ OPTION(osd_op_log_threshold, OPT_INT, 5) // how many op log messages to show in
 OPTION(osd_verify_sparse_read_holes, OPT_BOOL, false)  // read fiemap-reported holes and verify they are zeros
 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(filestore, OPT_BOOL, false)
 OPTION(filestore_debug_omap_check, OPT_BOOL, 0) // Expensive debugging check on sync
 // Use omap for xattrs for attrs over
index 8452a9fbaccdcb47a0ebed36a8a99c8aed76bf21..856a176f7996e6107713cd5440b6971c47ebb831 100644 (file)
@@ -697,6 +697,9 @@ OSD::OSD(int id, Messenger *internal_messenger, Messenger *external_messenger,
   peering_wq(this, g_conf->osd_op_thread_timeout, &op_tp, 200),
   map_lock("OSD::map_lock"),
   peer_map_epoch_lock("OSD::peer_map_epoch_lock"),
+  debug_drop_pg_create_probability(g_conf->osd_debug_drop_pg_create_probability),
+  debug_drop_pg_create_duration(g_conf->osd_debug_drop_pg_create_duration),
+  debug_drop_pg_create_left(-1),
   outstanding_pg_stats(false),
   up_thru_wanted(0), up_thru_pending(0),
   pg_stat_queue_lock("OSD::pg_stat_queue_lock"),
@@ -4090,6 +4093,21 @@ void OSD::handle_pg_create(OpRequestRef op)
 
   dout(10) << "handle_pg_create " << *m << dendl;
 
+  // drop the next N pg_creates in a row?
+  if (debug_drop_pg_create_left < 0 &&
+      g_conf->osd_debug_drop_pg_create_probability >
+      ((((double)(rand()%100))/100.0))) {
+    debug_drop_pg_create_left = debug_drop_pg_create_duration;
+  }
+  if (debug_drop_pg_create_left >= 0) {
+    --debug_drop_pg_create_left;
+    if (debug_drop_pg_create_left >= 0) {
+      dout(0) << "DEBUG dropping/ignoring pg_create, will drop the next "
+             << debug_drop_pg_create_left << " too" << dendl;
+      return;
+    }
+  }
+
   if (!require_mon_peer(op->request)) {
     // we have to hack around require_mon_peer's interface limits
     op->request = NULL;
index f1199a271e613ed84876939c10e7183c75190254..86c82c302dc915a431421c2e87420a7de0afb93d 100644 (file)
@@ -762,6 +762,9 @@ protected:
     int split_bits;
   };
   hash_map<pg_t, create_pg_info> creating_pgs;
+  double debug_drop_pg_create_probability;
+  int debug_drop_pg_create_duration;
+  int debug_drop_pg_create_left;  // 0 if we just dropped the last one, -1 if we can drop more
 
   bool can_create_pg(pg_t pgid);
   void handle_pg_create(OpRequestRef op);