From c036b151465a2ecb8bf24943e1030988f7e6c6ce Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Thu, 16 Nov 2023 12:36:25 -0500 Subject: [PATCH] common: support long running ops without slow warnings A quiesce op in the MDS may run for an indeterminate amount of time. Warnings should not be generated. Signed-off-by: Patrick Donnelly --- src/common/TrackedOp.cc | 6 +++++- src/common/TrackedOp.h | 23 +++++++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/common/TrackedOp.cc b/src/common/TrackedOp.cc index 0de21e38743ac..8de8c7d1ff410 100644 --- a/src/common/TrackedOp.cc +++ b/src/common/TrackedOp.cc @@ -207,7 +207,7 @@ void OpHistory::dump_slow_ops(utime_t now, Formatter *f, set filters) f->dump_int("threshold to keep", history_slow_op_threshold.load()); { f->open_array_section("Ops"); - for (const auto& [t, op] : slow_op) { + for ([[maybe_unused]] const auto& [t, op] : slow_op) { if (!op->filter_out(filters)) continue; f->open_object_section("Op"); @@ -388,6 +388,9 @@ bool OpTracker::with_slow_ops_in_flight(utime_t* oldest_secs, // no more slow ops in flight return false; } + if (op.is_continuous()) { + return true; /* skip reporting */ + } if (!op.warn_interval_multiplier) return true; slow++; @@ -502,6 +505,7 @@ void TrackedOp::dump(utime_t now, Formatter *f, OpTracker::dumper lambda) const f->dump_stream("initiated_at") << get_initiated(); f->dump_float("age", now - get_initiated()); f->dump_float("duration", get_duration()); + f->dump_bool("continuous", is_continuous()); { f->open_object_section("type_data"); lambda(*this, f); diff --git a/src/common/TrackedOp.h b/src/common/TrackedOp.h index 238f1c7ac7c5f..1a921309ca01b 100644 --- a/src/common/TrackedOp.h +++ b/src/common/TrackedOp.h @@ -207,6 +207,9 @@ public: template typename T::Ref create_request(U params) { + constexpr bool has_is_continuous = requires(U u) { + { u->is_continuous() } -> std::same_as; + }; typename T::Ref retval(new T(params, this)); retval->tracking_start(); if (is_tracking()) { @@ -215,18 +218,25 @@ public: retval->mark_event("all_read", params->get_recv_complete_stamp()); retval->mark_event("dispatched", params->get_dispatch_stamp()); } + if constexpr (has_is_continuous) { + if (params->is_continuous()) { + retval->mark_continuous(); + } + } return retval; } }; class TrackedOp : public boost::intrusive::list_base_hook<> { -private: +public: friend class OpHistory; friend class OpTracker; - boost::intrusive::list_member_hook<> tracker_item; + static const uint64_t FLAG_CONTINUOUS = (1<<1); +private: + boost::intrusive::list_member_hook<> tracker_item; public: typedef boost::intrusive::list< TrackedOp, @@ -243,6 +253,7 @@ public: } }; + protected: OpTracker *tracker; ///< the tracker we are associated with std::atomic_int nref = {0}; ///< ref count @@ -281,6 +292,14 @@ protected: STATE_HISTORY }; std::atomic state = {STATE_UNTRACKED}; + uint64_t flags = 0; + + void mark_continuous() { + flags |= FLAG_CONTINUOUS; + } + bool is_continuous() const { + return flags & FLAG_CONTINUOUS; + } TrackedOp(OpTracker *_tracker, const utime_t& initiated) : tracker(_tracker), -- 2.39.5