Skip to content

Commit

Permalink
Merge pull request ceph#7690 from xiexingguo/xxg-wip-14804
Browse files Browse the repository at this point in the history
common/TrackedOp: fix inaccurate counting for slow requests

Reviewed-by: Kefu Chai <[email protected]>
  • Loading branch information
liewegas committed Mar 2, 2016
2 parents b7a3217 + 52c04b8 commit c4f68ad
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/common/TrackedOp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,7 @@ bool OpTracker::check_ops_in_flight(std::vector<string> &warning_vector)

int slow = 0; // total slow
int warned = 0; // total logged
for (uint32_t iter = 0;
iter < num_optracker_shards && warned < log_threshold; iter++) {
for (uint32_t iter = 0; iter < num_optracker_shards; iter++) {
ShardedTrackingData* sdata = sharded_in_flight_list[iter];
assert(NULL != sdata);
Mutex::Locker locker(sdata->ops_in_flight_lock_sharded);
Expand All @@ -215,12 +214,10 @@ bool OpTracker::check_ops_in_flight(std::vector<string> &warning_vector)
slow++;

// exponential backoff of warning intervals
if (((*i)->get_initiated() +
(complaint_time * (*i)->warn_interval_multiplier)) < now) {
// will warn
if (warned < log_threshold &&
((*i)->get_initiated() + (complaint_time * (*i)->warn_interval_multiplier)) < now) {
// will warn, increase counter
warned++;
if (warned > log_threshold)
break;

utime_t age = now - (*i)->get_initiated();
stringstream ss;
Expand All @@ -247,7 +244,7 @@ bool OpTracker::check_ops_in_flight(std::vector<string> &warning_vector)
warning_vector[0] = ss.str();
}

return warned;
return warned > 0;
}

void OpTracker::get_age_ms_histogram(pow2_hist_t *h)
Expand Down

0 comments on commit c4f68ad

Please sign in to comment.