OPTION(auth_debug, OPT_BOOL, false) // if true, assert when weird things happen
OPTION(mon_client_hunt_interval, OPT_DOUBLE, 3.0) // try new mon every N seconds until we connect
OPTION(mon_client_ping_interval, OPT_DOUBLE, 10.0) // ping every N seconds
+OPTION(mon_client_hunt_interval_backoff, OPT_DOUBLE, 2.0) // each time we reconnect to a monitor, double our timeout
+OPTION(mon_client_hunt_interval_max_multiple, OPT_DOUBLE, 10.0) // up to a max of 10*default (30 seconds)
OPTION(mon_client_max_log_entries_per_message, OPT_INT, 1000)
OPTION(mon_max_pool_pg_num, OPT_INT, 65536)
OPTION(mon_pool_quota_warn_threshold, OPT_INT, 0) // percent of quota at which to issue warnings
want_keys(0), global_id(0),
authenticate_err(0),
session_established_context(NULL),
+ had_a_connection(false),
+ reopen_interval_multiplier(1.0),
auth(NULL),
keyring(NULL),
rotating_secrets(NULL),
version_requests.erase(version_requests.begin());
}
+ // adjust timeouts if necessary
+ if (had_a_connection) {
+ reopen_interval_multiplier *= cct->_conf->mon_client_hunt_interval_backoff;
+ if (reopen_interval_multiplier >
+ cct->_conf->mon_client_hunt_interval_max_multiple)
+ reopen_interval_multiplier =
+ cct->_conf->mon_client_hunt_interval_max_multiple;
+ }
+
// restart authentication handshake
state = MC_STATE_NEGOTIATING;
hunting = true;
if (hunting) {
ldout(cct, 1) << "found mon." << cur_mon << dendl;
hunting = false;
+ had_a_connection = true;
+ reopen_interval_multiplier /= 2.0;
+ if (reopen_interval_multiplier < 1.0)
+ reopen_interval_multiplier = 1.0;
}
}
void MonClient::schedule_tick()
{
if (hunting)
- timer.add_event_after(cct->_conf->mon_client_hunt_interval, new C_Tick(this));
+ timer.add_event_after(cct->_conf->mon_client_hunt_interval
+ * reopen_interval_multiplier, new C_Tick(this));
else
timer.add_event_after(cct->_conf->mon_client_ping_interval, new C_Tick(this));
}