From 390d734473d05ece2f747ea74a24da91d543cf66 Mon Sep 17 00:00:00 2001 From: "yite.gu" Date: Thu, 15 Jun 2023 19:41:53 +0800 Subject: [PATCH] mds/MDSRank: Add set_history_slow_op_size_and_threshold for op_tracker void OpHistory::_insert_delayed(const utime_t& now, TrackedOpRef op) { ... double opduration = op->get_duration(); ... if (opduration >= history_slow_op_threshold.load()) { slow_op.insert(make_pair(op->get_initiated(), op)); logger->inc(l_trackedop_slow_op_count); } ... } mds op_tracker have no set slow op threshold, and history_slow_op_threshold default value is 0, cause to mds have slow op alway. Fixes: https://tracker.ceph.com/issues/61749 Signed-off-by: Yite Gu (cherry picked from commit 9b88a4759b1559c16f9874e9a9493573ec799be8) --- src/common/options/mds.yaml.in | 18 ++++++++++++++++++ src/mds/MDSRank.cc | 5 +++++ 2 files changed, 23 insertions(+) diff --git a/src/common/options/mds.yaml.in b/src/common/options/mds.yaml.in index 6eb0702fcdd..ac74a883b90 100644 --- a/src/common/options/mds.yaml.in +++ b/src/common/options/mds.yaml.in @@ -1175,6 +1175,24 @@ options: services: - mds with_legacy: true +# Max number of slow ops to track +- name: mds_op_history_slow_op_size + type: uint + level: advanced + desc: maximum size for list of historical slow operations + default: 20 + services: + - mds + with_legacy: true +# Track the op if over this threshold +- name: mds_op_history_slow_op_threshold + type: uint + level: advanced + desc: track the op if over this threshold + default: 10 + services: + - mds + with_legacy: true # how many seconds old makes an op complaint-worthy - name: mds_op_complaint_time type: float diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 9a80534a4d5..166d640ff04 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -551,6 +551,8 @@ MDSRank::MDSRank( cct->_conf->mds_op_log_threshold); op_tracker.set_history_size_and_duration(cct->_conf->mds_op_history_size, cct->_conf->mds_op_history_duration); + op_tracker.set_history_slow_op_size_and_threshold(cct->_conf->mds_op_history_slow_op_size, + cct->_conf->mds_op_history_slow_op_threshold); schedule_update_timer_task(); } @@ -3842,6 +3844,9 @@ void MDSRankDispatcher::handle_conf_change(const ConfigProxy& conf, const std::s if (changed.count("mds_op_history_size") || changed.count("mds_op_history_duration")) { op_tracker.set_history_size_and_duration(conf->mds_op_history_size, conf->mds_op_history_duration); } + if (changed.count("mds_op_history_slow_op_size") || changed.count("mds_op_history_slow_op_threshold")) { + op_tracker.set_history_slow_op_size_and_threshold(conf->mds_op_history_slow_op_size, conf->mds_op_history_slow_op_threshold); + } if (changed.count("mds_enable_op_tracker")) { op_tracker.set_tracking(conf->mds_enable_op_tracker); } -- 2.39.5