From c8ee30160d2253a8398df926e851bfa201ab2a39 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 18 Jul 2012 12:20:24 -0700 Subject: [PATCH] osd: add osd_debug_drop_pg_create_{probability,duration} options This will let us exercise more of the pg creation code. Signed-off-by: Sage Weil --- src/common/config_opts.h | 2 ++ src/osd/OSD.cc | 18 ++++++++++++++++++ src/osd/OSD.h | 3 +++ 3 files changed, 23 insertions(+) diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 32dcadf45dd8d..c93d21beb2e65 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -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 diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 8452a9fbaccdc..856a176f7996e 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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; diff --git a/src/osd/OSD.h b/src/osd/OSD.h index f1199a271e613..86c82c302dc91 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -762,6 +762,9 @@ protected: int split_bits; }; hash_map 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); -- 2.39.5