Skip to content

Commit 949f25e

Browse files
committed
mon/scrub: add mon scrub latency
If mon store.db very big, scrub will be a very time-consuming operation. Fixes: https://tracker.ceph.com/issues/66873 Signed-off-by: Yite Gu <[email protected]>
1 parent e7f3bed commit 949f25e

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/mon/Monitor.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5661,10 +5661,13 @@ void Monitor::handle_scrub(MonOpRequestRef op)
56615661
if (scrub_result.size() == quorum.size()) {
56625662
scrub_check_results();
56635663
scrub_result.clear();
5664-
if (scrub_state->finished)
5664+
if (scrub_state->finished) {
5665+
const utime_t lat = ceph_clock_now() - scrub_state->start;
5666+
dout(10) << __func__ << " mon scrub latency: " << lat << dendl;
56655667
scrub_finish();
5666-
else
5668+
} else {
56675669
scrub();
5670+
}
56685671
}
56695672
}
56705673
break;

src/mon/Monitor.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,10 @@ class Monitor : public Dispatcher,
341341
struct ScrubState {
342342
std::pair<std::string,std::string> last_key; ///< last scrubbed key
343343
bool finished;
344+
const utime_t start;
344345

345-
ScrubState() : finished(false) { }
346+
ScrubState() : finished(false),
347+
start(ceph_clock_now()) { }
346348
virtual ~ScrubState() { }
347349
};
348350
std::shared_ptr<ScrubState> scrub_state; ///< keeps track of current scrub

0 commit comments

Comments
 (0)