]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd debug: Add testing support by adding random read error only when building push ops
authorDavid Zafman <dzafman@redhat.com>
Thu, 25 May 2017 17:37:00 +0000 (10:37 -0700)
committerDavid Zafman <dzafman@redhat.com>
Fri, 23 Jun 2017 15:09:15 +0000 (08:09 -0700)
add osd_debug_random_push_read_error config option

Signed-off-by: David Zafman <dzafman@redhat.com>
src/common/config_opts.h
src/osd/ReplicatedBackend.cc

index 9d3a418fa3307bf9edbf69a8fa1d884c8923aff0..c152bf08575930efb990bc7c6fd91b35ba27a8a8 100644 (file)
@@ -897,6 +897,7 @@ OPTION(osd_debug_reject_backfill_probability, OPT_DOUBLE, 0)
 OPTION(osd_debug_inject_copyfrom_error, OPT_BOOL, false)  // inject failure during copyfrom completion
 OPTION(osd_debug_misdirected_ops, OPT_BOOL, false)
 OPTION(osd_debug_skip_full_check_in_recovery, OPT_BOOL, false)
+OPTION(osd_debug_random_push_read_error, OPT_DOUBLE, 0)
 OPTION(osd_debug_verify_cached_snaps, OPT_BOOL, false)
 OPTION(osd_enable_op_tracker, OPT_BOOL, true) // enable/disable OSD op tracking
 OPTION(osd_num_op_tracker_shard, OPT_U32, 32) // The number of shards for holding the ops
index 4e9ea976f29e88a10d0616d20898ab15fb324a67..591e8a4c1ed33f97e26279813a1db1722dc1b782 100644 (file)
@@ -2038,6 +2038,11 @@ int ReplicatedBackend::build_push_op(const ObjectRecoveryInfo &recovery_info,
     int r = store->read(ch, ghobject_t(recovery_info.soid),
                p.get_start(), p.get_len(), bit,
                 cache_dont_need ? CEPH_OSD_OP_FLAG_FADVISE_DONTNEED: 0);
+    if (cct->_conf->osd_debug_random_push_read_error &&
+        (rand() % (int)(cct->_conf->osd_debug_random_push_read_error * 100.0)) == 0) {
+      dout(0) << __func__ << ": inject EIO " << recovery_info.soid << dendl;
+      r = -EIO;
+    }
     if (r < 0) {
       return r;
     }