]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Add debug_heartbeat_testing_span to allow quicker testing
authorDavid Zafman <dzafman@redhat.com>
Wed, 24 Jul 2019 21:19:43 +0000 (14:19 -0700)
committerDavid Zafman <dzafman@redhat.com>
Mon, 4 Nov 2019 22:21:21 +0000 (14:21 -0800)
Signed-off-by: David Zafman <dzafman@redhat.com>
(cherry picked from commit 573aea2bb1d48237df5182a6e4421e15c1eea88c)

src/common/options.cc
src/osd/OSD.cc
src/osd/OSD.h

index bae38494fdec586c5c60ed108f91af447c5a9ef6..97e01243d31c2ccc03d314dca157720edef743f7 100644 (file)
@@ -5539,6 +5539,10 @@ std::vector<Option> get_global_options() {
     Option("debug_disable_randomized_ping", Option::TYPE_BOOL, Option::LEVEL_DEV)
     .set_default(false)
     .set_description("Disable heartbeat ping randomization for testing purposes"),
+
+    Option("debug_heartbeat_testing_span", Option::TYPE_INT, Option::LEVEL_DEV)
+    .set_default(0)
+    .set_description("Override 60 second periods for testing only"),
   });
 }
 
index fc959e45a4a6db89b9f0e3f48fb9eda418d5863e..d8d4900b65b9195fc5e6a4ec0caef8dd58a938fc 100644 (file)
@@ -5273,7 +5273,11 @@ void OSD::handle_osd_ping(MOSDPing *m)
            ceph_assert(i->second.hb_interval_start != utime_t());
            if (i->second.hb_interval_start == utime_t())
              i->second.hb_interval_start = now;
-           if (now - i->second.hb_interval_start >=  utime_t(hb_avg, 0)) {
+           int64_t hb_avg_time_period = 60;
+           if (cct->_conf.get_val<int64_t>("debug_heartbeat_testing_span")) {
+             hb_avg_time_period = cct->_conf.get_val<int64_t>("debug_heartbeat_testing_span");
+           }
+           if (now - i->second.hb_interval_start >=  utime_t(hb_avg_time_period, 0)) {
               uint32_t back_avg = i->second.hb_total_back / i->second.hb_average_count;
               uint32_t back_min = i->second.hb_min_back;
               uint32_t back_max = i->second.hb_max_back;
index 2e9bae1da7c69cb832143c67b1680fd8ccc2f019..a57a7943c53a6099de64637ffe657d3dd34b4b4e 100644 (file)
@@ -1634,7 +1634,6 @@ private:
   utime_t last_heartbeat_resample;   ///< last time we chose random peers in waiting-for-healthy state
   double daily_loadavg;
 
-  const uint32_t hb_avg = 60;
   // Track ping repsonse times using vector as a circular buffer
   // MUST BE A POWER OF 2
   const uint32_t hb_vector_size = 16;