From 85b17ba18b03dcfe0513de110f29197c49212331 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 18 May 2017 17:19:08 -0400 Subject: [PATCH] osd: report a seq from flush_pg_stats command Report a sequence number when we flush_pg_stats. Combine the up_from and a per-boot seq number to get a monotonically increasing value across OSD restarts (we assume less than 4 billion stats reports in a single epoch). Signed-off-by: Sage Weil --- src/osd/OSD.cc | 1 + src/osd/OSD.h | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 66516646eb186..92f0d1f11fc85 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -6461,6 +6461,7 @@ void OSD::do_command(Connection *con, ceph_tid_t tid, vector& cmd, buffe else if (prefix == "flush_pg_stats") { if (osdmap->require_osd_release >= CEPH_RELEASE_LUMINOUS) { mgrc.send_pgstats(); + ds << service.get_osd_stat_seq() << "\n"; } else { flush_pg_stats(); } diff --git a/src/osd/OSD.h b/src/osd/OSD.h index d8782ce906f1b..36c8c3e065f81 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -1147,14 +1147,20 @@ public: // -- stats -- Mutex stat_lock; osd_stat_t osd_stat; + uint32_t seq = 0; void update_osd_stat(vector& hb_peers); osd_stat_t get_osd_stat() { Mutex::Locker l(stat_lock); + ++seq; osd_stat.up_from = up_epoch; - ++osd_stat.seq; + osd_stat.seq = ((uint64_t)osd_stat.up_from << 32) + seq; return osd_stat; } + uint64_t get_osd_stat_seq() { + Mutex::Locker l(stat_lock); + return osd_stat.seq; + } // -- OSD Full Status -- private: -- 2.39.5