Skip to content

Commit

Permalink
osd: Add debug_disable_randomized_ping config for use in testing
Browse files Browse the repository at this point in the history
Signed-off-by: David Zafman <dzafman@redhat.com>
  • Loading branch information
dzafman committed Aug 26, 2019
1 parent 048f809 commit f2b26d8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/common/options.cc
Expand Up @@ -5579,6 +5579,10 @@ std::vector<Option> get_global_options() {
.set_description("")
.add_service({"mon", "osd"})
.set_long_description("This sets the gss target service name."),

Option("debug_disable_randomized_ping", Option::TYPE_BOOL, Option::LEVEL_DEV)
.set_default(false)
.set_description("Disable heartbeat ping randomization for testing purposes"),
});
}

Expand Down
7 changes: 6 additions & 1 deletion src/osd/OSD.cc
Expand Up @@ -5031,7 +5031,12 @@ void OSD::heartbeat_entry()
while (!heartbeat_stop) {
heartbeat();

double wait = .5 + ((float)(rand() % 10)/10.0) * (float)cct->_conf->osd_heartbeat_interval;
double wait;
if (cct->_conf.get_val<bool>("debug_disable_randomized_ping")) {
wait = (float)cct->_conf->osd_heartbeat_interval;
} else {
wait = .5 + ((float)(rand() % 10)/10.0) * (float)cct->_conf->osd_heartbeat_interval;
}
auto w = ceph::make_timespan(wait);
dout(30) << "heartbeat_entry sleeping for " << wait << dendl;
heartbeat_cond.wait_for(l, w);
Expand Down

0 comments on commit f2b26d8

Please sign in to comment.