OPTION(auth_debug, OPT_BOOL) // if true, assert when weird things happen
OPTION(mon_client_hunt_parallel, OPT_U32) // how many mons to try to connect to in parallel during hunt
OPTION(mon_client_hunt_interval, OPT_DOUBLE) // try new mon every N seconds until we connect
+OPTION(mon_client_log_interval, OPT_DOUBLE) // send logs every N seconds
OPTION(mon_client_ping_interval, OPT_DOUBLE) // ping every N seconds
OPTION(mon_client_ping_timeout, OPT_DOUBLE) // fail if we don't hear back
OPTION(mon_client_hunt_interval_backoff, OPT_DOUBLE) // each time we reconnect to a monitor, double our timeout
{
ldout(cct, 10) << __func__ << dendl;
+ utime_t now = ceph_clock_now();
+
auto reschedule_tick = make_scope_guard([this] {
schedule_tick();
});
return _reopen_session();
} else if (active_con) {
// just renew as needed
- utime_t now = ceph_clock_now();
auto cur_con = active_con->get_con();
if (!cur_con->has_feature(CEPH_FEATURE_MON_STATEFUL_SUB)) {
const bool maybe_renew = sub.need_renew();
}
}
- cur_con->send_keepalive();
-
- if (cct->_conf->mon_client_ping_timeout > 0 &&
- cur_con->has_feature(CEPH_FEATURE_MSGR_KEEPALIVE2)) {
- utime_t lk = cur_con->get_last_keepalive_ack();
- utime_t interval = now - lk;
- if (interval > cct->_conf->mon_client_ping_timeout) {
- ldout(cct, 1) << "no keepalive since " << lk << " (" << interval
- << " seconds), reconnecting" << dendl;
- return _reopen_session();
+ if (now > last_keepalive + cct->_conf->mon_client_ping_interval) {
+ cur_con->send_keepalive();
+ last_keepalive = now;
+
+ if (cct->_conf->mon_client_ping_timeout > 0 &&
+ cur_con->has_feature(CEPH_FEATURE_MSGR_KEEPALIVE2)) {
+ utime_t lk = cur_con->get_last_keepalive_ack();
+ utime_t interval = now - lk;
+ if (interval > cct->_conf->mon_client_ping_timeout) {
+ ldout(cct, 1) << "no keepalive since " << lk << " (" << interval
+ << " seconds), reconnecting" << dendl;
+ return _reopen_session();
+ }
}
- }
- _un_backoff();
+ _un_backoff();
+ }
- send_log();
+ if (now > last_send_log + cct->_conf->mon_client_log_interval) {
+ send_log();
+ last_send_log = now;
+ }
}
}
reopen_interval_multiplier);
timer.add_event_after(hunt_interval, do_tick);
} else {
- timer.add_event_after(cct->_conf->mon_client_ping_interval, do_tick);
+ timer.add_event_after(std::min(cct->_conf->mon_client_ping_interval,
+ cct->_conf->mon_client_log_interval),
+ do_tick);
}
}