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 <sage@inktank.com>
This commit is contained in:
Sage Weil 2012-07-18 12:20:24 -07:00 committed by Samuel Just
parent 8f5562ffe6
commit c8ee30160d
3 changed files with 23 additions and 0 deletions

View 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

View 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;

View 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);