m_osds->clog->do_log(CLOG_WARN, warning);
}
-ostream& PgScrubber::show(ostream& out) const
-{
- return out << " [ " << m_pg_id << ": " << m_flags << " ] ";
+
+ostream& PgScrubber::show_concise(ostream& out) const
+{
+ /*
+ * 'show_concise()' is only used when calling operator<< thru the ScrubPgIF,
+ * i.e. only by the PG when creating a standard log entry.
+ *
+ * desired outcome (only relevant for Primaries):
+ *
+ * if scrubbing:
+ * (urgency,flags)
+ * or (if blocked)
+ * (*blocked*,urgency,flags)
+ *
+ * if not scrubbing:
+ * either nothing (if only periodic scrubs are scheduled)
+ * or [next-scrub: effective-lvl, urgency]
+ */
+ if (!is_primary()) {
+ return out;
+ }
+
+ if (m_active) {
+ const auto flags_txt = fmt::format("{}", m_flags);
+ const std::string sep = (flags_txt.empty() ? "" : ",");
+ if (m_active_target) {
+ return out << fmt::format(
+ "({}{}{}{})", (m_scrub_job->blocked ? "*blocked*," : ""),
+ m_active_target->urgency(), sep, flags_txt);
+ } else {
+ // only expected in a couple of messages during scrub termination
+ return out << fmt::format(
+ "(teardown{}{}{})", (m_scrub_job->blocked ? "-*blocked*" : ""),
+ sep, flags_txt);
+ }
+ }
+
+ // not actively scrubbing now. Show some info about the next scrub
+ const auto now_is = ceph_clock_now();
+ const auto& next_scrub = m_scrub_job->earliest_target(now_is);
+ if (!next_scrub.is_high_priority()) {
+ // no interesting flags to report
+ return out;
+ }
+ return out << fmt::format(
+ "[next-scrub:{},{:10.10}]", (next_scrub.is_deep() ? "dp" : "sh"),
+ next_scrub.urgency());
}
int PgScrubber::asok_debug(std::string_view cmd,
struct formatter<scrub_flags_t> {
constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); }
template <typename FormatContext>
- auto format(scrub_flags_t& sf, FormatContext& ctx) const
+ auto format(const scrub_flags_t& sf, FormatContext& ctx) const
{
std::string txt;
bool sep{false};
/// to complete (in order to perform an 'after-repair' scrub)
bool m_after_repair_scrub_required{false};
- ostream& show(ostream& out) const override;
+ ostream& show_concise(ostream& out) const override;
public:
// ------------------ the I/F used by the ScrubBackend (ScrubBeListener)
bool m_publish_sessions{false}; //< will the counter be part of 'query'
//output?
+ /**
+ * the scrub operation flags.
+ * Set at scrub start. Checked in multiple locations - mostly
+ * at finish.
+ * Note: replicas only use the 'priority' field.
+ */
scrub_flags_t m_flags;
bool m_active{false};
virtual ~ScrubPgIF() = default;
- friend std::ostream& operator<<(std::ostream& out, const ScrubPgIF& s)
- {
- return s.show(out);
+ friend std::ostream& operator<<(std::ostream& out, const ScrubPgIF& s) {
+ return s.show_concise(out);
}
- virtual std::ostream& show(std::ostream& out) const = 0;
+ virtual std::ostream& show_concise(std::ostream& out) const = 0;
// --------------- triggering state-machine events: