{
while (arrived.size() &&
(now - arrived.begin()->first >
- (double)(tracker->cct->_conf->op_tracker_history_duration))) {
+ (double)(history_duration))) {
duration.erase(make_pair(
arrived.begin()->second->get_duration(),
arrived.begin()->second));
arrived.erase(arrived.begin());
}
- while (duration.size() > tracker->cct->_conf->op_tracker_history_size) {
+ while (duration.size() > history_size) {
arrived.erase(make_pair(
duration.begin()->second->get_arrived(),
duration.begin()->second));
{
cleanup(now);
f->open_object_section("OpHistory");
- f->dump_int("num to keep", tracker->cct->_conf->op_tracker_history_size);
- f->dump_int("duration to keep", tracker->cct->_conf->op_tracker_history_duration);
+ f->dump_int("num to keep", history_size);
+ f->dump_int("duration to keep", history_duration);
{
f->open_array_section("Ops");
for (set<pair<utime_t, TrackedOpRef> >::const_iterator i =
utime_t now = ceph_clock_now(cct);
utime_t too_old = now;
- too_old -= cct->_conf->op_tracker_complaint_time;
+ too_old -= complaint_time;
utime_t oldest_secs = now - ops_in_flight.front()->get_arrived();
<< "; oldest is " << oldest_secs
<< " seconds old" << dendl;
- if (oldest_secs < cct->_conf->op_tracker_complaint_time)
+ if (oldest_secs < complaint_time)
return false;
xlist<TrackedOp*>::iterator i = ops_in_flight.begin();
- warning_vector.reserve(cct->_conf->op_tracker_log_threshold + 1);
+ warning_vector.reserve(log_threshold + 1);
int slow = 0; // total slow
int warned = 0; // total logged
// exponential backoff of warning intervals
if (((*i)->get_arrived() +
- (cct->_conf->op_tracker_complaint_time *
- (*i)->warn_interval_multiplier)) < now) {
+ (complaint_time * (*i)->warn_interval_multiplier)) < now) {
// will warn
if (warning_vector.empty())
warning_vector.push_back("");
warned++;
- if (warned > cct->_conf->op_tracker_log_threshold)
+ if (warned > log_threshold)
break;
utime_t age = now - (*i)->get_arrived();
void cleanup(utime_t now);
bool shutdown;
OpTracker *tracker;
+ uint32_t history_size;
+ uint32_t history_duration;
public:
- OpHistory(OpTracker *tracker_) : shutdown(false), tracker(tracker_) {}
+ OpHistory(OpTracker *tracker_) : shutdown(false), tracker(tracker_),
+ history_size(0), history_duration(0) {}
~OpHistory() {
assert(arrived.empty());
assert(duration.empty());
void insert(utime_t now, TrackedOpRef op);
void dump_ops(utime_t now, Formatter *f);
void on_shutdown();
+ void set_size_and_duration(uint32_t new_size, uint32_t new_duration) {
+ history_size = new_size;
+ history_duration = new_duration;
+ }
};
class OpTracker {
Mutex ops_in_flight_lock;
xlist<TrackedOp *> ops_in_flight;
OpHistory history;
+ float complaint_time;
+ int log_threshold;
public:
CephContext *cct;
- OpTracker(CephContext *cct_) : seq(0), ops_in_flight_lock("OpTracker mutex"), history(this), cct(cct_) {}
+ OpTracker(CephContext *cct_) : seq(0), ops_in_flight_lock("OpTracker mutex"),
+ history(this), complaint_time(0), log_threshold(0), cct(cct_) {}
+ void set_complaint_and_threshold(float time, int threshold) {
+ complaint_time = time;
+ log_threshold = threshold;
+ }
+ void set_history_size_and_duration(uint32_t new_size, uint32_t new_duration) {
+ history.set_size_and_duration(new_size, new_duration);
+ }
void dump_ops_in_flight(Formatter *f);
void dump_historic_ops(Formatter *f);
void register_inflight_op(xlist<TrackedOp*>::item *i);
OPTION(osd_min_pg_log_entries, OPT_U32, 3000) // number of entries to keep in the pg log when trimming it
OPTION(osd_max_pg_log_entries, OPT_U32, 10000) // max entries, say when degraded, before we trim
-OPTION(op_tracker_complaint_time, OPT_FLOAT, 30) // how many seconds old makes an op complaint-worthy
+OPTION(osd_op_complaint_time, OPT_FLOAT, 30) // how many seconds old makes an op complaint-worthy
OPTION(osd_command_max_records, OPT_INT, 256)
-OPTION(op_tracker_log_threshold, OPT_INT, 5) // how many op log messages to show in one go
+OPTION(osd_op_log_threshold, OPT_INT, 5) // how many op log messages to show in one go
OPTION(osd_verify_sparse_read_holes, OPT_BOOL, false) // read fiemap-reported holes and verify they are zeros
OPTION(osd_debug_drop_ping_probability, OPT_DOUBLE, 0)
OPTION(osd_debug_drop_ping_duration, OPT_INT, 0)
OPTION(osd_debug_verify_snaps_on_info, OPT_BOOL, false)
OPTION(osd_debug_verify_stray_on_activate, OPT_BOOL, false)
OPTION(osd_debug_skip_full_check_in_backfill_reservation, OPT_BOOL, false)
-OPTION(op_tracker_history_size, OPT_U32, 20) // Max number of completed ops to track
-OPTION(op_tracker_history_duration, OPT_U32, 600) // Oldest completed op to track
+OPTION(osd_op_history_size, OPT_U32, 20) // Max number of completed ops to track
+OPTION(osd_op_history_duration, OPT_U32, 600) // Oldest completed op to track
OPTION(osd_target_transaction_size, OPT_INT, 30) // to adjust various transactions that batch smaller items
OPTION(osd_failsafe_full_ratio, OPT_FLOAT, .97) // what % full makes an OSD "full" (failsafe)
OPTION(osd_failsafe_nearfull_ratio, OPT_FLOAT, .90) // what % full makes an OSD near full (failsafe)
* 1..63.
*
* osd_recovery_op_warn_multiple scales the normal warning threshhold,
- * op_tracker_complaint_time, so that slow recovery ops won't cause noise
+ * osd_op_complaint_time, so that slow recovery ops won't cause noise
*/
OPTION(osd_client_op_priority, OPT_U32, 63)
OPTION(osd_recovery_op_priority, OPT_U32, 10)
service(this)
{
monc->set_messenger(client_messenger);
+ op_tracker.set_complaint_and_threshold(cct->_conf->osd_op_complaint_time,
+ cct->_conf->osd_op_log_threshold);
+ op_tracker.set_history_size_and_duration(cct->_conf->osd_op_history_size,
+ cct->_conf->osd_op_history_duration);
}
OSD::~OSD()
if (cur_state != new_state) {
cur_state = new_state;
- } else if (now - last_msg < cct->_conf->op_tracker_complaint_time) {
+ } else if (now - last_msg < cct->_conf->osd_op_complaint_time) {
return;
}
last_msg = now;
{
static const char* KEYS[] = {
"osd_max_backfills",
+ "osd_op_complaint_time", "osd_op_log_threshold",
+ "osd_op_history_size", "osd_op_history_duration",
NULL
};
return KEYS;
service.local_reserver.set_max(cct->_conf->osd_max_backfills);
service.remote_reserver.set_max(cct->_conf->osd_max_backfills);
}
+ if (changed.count("osd_op_complaint_time") ||
+ changed.count("osd_op_log_threshold")) {
+ op_tracker.set_complaint_and_threshold(cct->_conf->osd_op_complaint_time,
+ cct->_conf->osd_op_log_threshold);
+ }
+ if (changed.count("osd_op_history_size") ||
+ changed.count("osd_op_history_duration")) {
+ op_tracker.set_history_size_and_duration(cct->_conf->osd_op_history_size,
+ cct->_conf->osd_op_history_duration);
+ }
}
// --------------------------------