Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
common/TrackedOp: fix inaccurate counting for slow requests #7690
@xiexingguo could you elaborated a little bit why the total # of slow request is not accurate? iiuc, we failed to collect the last op in the warning message. but it would better if you can put it in your commit message to help reviewers and other developers to understand your change.
The problem here is if 'warned' counter hits the log_threshold, we will quit the entire for loop but there may be residual shard_queues which may still containing slow requests. As a result, the 'slow' counter does not reflect the real number of total slow requests in all the shard_queues under this case. And no slow requests will be tracked especially when 'log_threshold' is set to zero.
The solution for the above problem is to keep counting 'slow' requests until we have finished traversing all the shard_queues, no matter whether we have gathered enough requests for log or not, and if so, we simply stop counter 'warned' and skip over logging process.