namespace {
static constexpr int TICK_INTERVAL = 1;
+ static constexpr int TRIM_QLENGTHS_UPDATE_PERIOD = 5;
}
using std::make_unique;
).then([this] {
update_stats();
mgrc->update_daemon_health(get_health_metrics());
+ if (++trim_queue_length_countdown >= TRIM_QLENGTHS_UPDATE_PERIOD) {
+ trim_queue_length_countdown = 0;
+ std::ignore = pg_shard_manager.calc_snap_trim_queue_total(
+ ).then([this](uint64_t total) {
+ LOG_PREFIX(OSD::tick);
+ snap_trim_queue_total = total;
+ DEBUG("snap_trim_queue_total: {}", total);
+ });
+ }
tick_timer.arm(
std::chrono::seconds(TICK_INTERVAL));
});
std::unique_ptr<Heartbeat> heartbeat;
seastar::timer<seastar::lowres_clock> tick_timer;
+ uint_fast16_t trim_queue_length_countdown = 0;
+ /// caching the total snap trim queue length across all PGs,
+ /// updated periodically by the tick_timer
+ uint64_t snap_trim_queue_total = 0;
seastar::timer<seastar::lowres_clock> stats_timer;
std::vector<ShardServices::shard_stats_t> shard_stats;
});
}
+seastar::future<uint64_t>
+PGShardManager::calc_snap_trim_queue_total() const
+{
+ uint64_t total = 0;
+ co_await for_each_pg([&total](const auto&, const auto &pg) {
+ if (pg->is_primary()) {
+ total += pg->get_snap_trimq_size();
+ }
+ });
+ co_return total;
+}
+
}
});
}
+ seastar::future<uint64_t> calc_snap_trim_queue_total() const;
+
/**
* for_each_pgid
*