]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd: report a seq from flush_pg_stats command
authorSage Weil <sage@redhat.com>
Thu, 18 May 2017 21:19:08 +0000 (17:19 -0400)
committerSage Weil <sage@redhat.com>
Fri, 2 Jun 2017 17:02:45 +0000 (13:02 -0400)
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 <sage@redhat.com>
src/osd/OSD.cc
src/osd/OSD.h

index 66516646eb1864c930270e2e4f1462bef0d8e5c1..92f0d1f11fc8553fa399d775b5d304e2b9fa475c 100644 (file)
@@ -6461,6 +6461,7 @@ void OSD::do_command(Connection *con, ceph_tid_t tid, vector<string>& 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();
     }
index d8782ce906f1b94906e18d6d6e55e7a211be0515..36c8c3e065f81efd3625552c138e94de18ab794f 100644 (file)
@@ -1147,14 +1147,20 @@ public:
   // -- stats --
   Mutex stat_lock;
   osd_stat_t osd_stat;
+  uint32_t seq = 0;
 
   void update_osd_stat(vector<int>& 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: