}
if (is_active()) {
+ constexpr uint_fast16_t snap_trim_scan_interval = 5;
+ if (++trim_queue_length_countdown >= snap_trim_scan_interval) {
+ trim_queue_length_countdown = 0;
+ service.snap_trim_queue_total =
+ service.calc_snap_trim_queue_total();
+ }
service.get_scrub_services().initiate_scrub(service.is_recovery_active());
service.promote_throttle_recalibrate();
resume_creating_pg();
}
+uint64_t OSDService::calc_snap_trim_queue_total()
+{
+ std::vector<spg_t> pgids;
+ osd->_get_pgids(&pgids);
+ uint64_t total = 0;
+ for (auto& pgid : pgids) {
+ if (auto locked_pg = get_locked_pg(pgid)) {
+ const auto& pg = locked_pg->pg();
+ if (pg->is_primary()) {
+ total += pg->get_snap_trimq_size();
+ }
+ }
+ }
+ return total;
+}
+
MPGStats* OSD::collect_pg_stats()
{
dout(15) << __func__ << dendl;
}
int get_nodeid() const final { return whoami; }
+
+ /// iterate over all PGs, summing their snap trim queue lengths
+ uint64_t calc_snap_trim_queue_total();
+ uint64_t get_snap_trim_queue_total() const {
+ // the cached value, calculated by calc_snap_trim_queue_total()
+ return snap_trim_queue_total;
+ }
+
+ // not atomic: both write (tick_without_osd_lock) and read (initiate_scrub,
+ // called from the same timer callback) are on the same thread
+ uint64_t snap_trim_queue_total{0};
+
private:
OSDMapRef osdmap;
// Tick timer for those stuff that do not need osd_lock
ceph::mutex tick_timer_lock = ceph::make_mutex("OSD::tick_timer_lock");
SafeTimer tick_timer_without_osd_lock;
+ uint_fast16_t trim_queue_length_countdown = 0;
std::string gss_ktfile_client{};
public:
<< dendl;
}
+ {
+ auto stqt = m_osd_svc.get_snap_trim_queue_total();
+ dout(20) << fmt::format("snap_trim_queue_total: {}", stqt) << dendl;
+ }
+
const utime_t scrub_time = ceph_clock_now();
// check the OSD-wide environment conditions (scrub resources, time, etc.).
*/
virtual AsyncReserver<spg_t, Finisher>& get_scrub_reserver() = 0;
+ virtual uint64_t get_snap_trim_queue_total() const = 0;
+
virtual ~ScrubSchedListener() {}
};