]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd/OSDMap: add last_purged_snaps_stamp to osd_xinfo_t
authorSage Weil <sage@redhat.com>
Wed, 26 Jun 2019 17:51:54 +0000 (12:51 -0500)
committerSage Weil <sage@redhat.com>
Tue, 2 Jul 2019 13:37:51 +0000 (08:37 -0500)
Record OSDs' last scrub of purged_snaps in the OSDMap.

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSDMap.cc
src/osd/OSDMap.h
src/tools/ceph-dencoder/osd_types.h

index 2f6b2bbc3a823de86e1bbf4d73d84409e6ed81f2..788715d6867346c5cb4f6e3af2bc84311cd8be82 100644 (file)
@@ -132,23 +132,31 @@ void osd_xinfo_t::dump(Formatter *f) const
   f->dump_int("laggy_interval", laggy_interval);
   f->dump_int("features", features);
   f->dump_unsigned("old_weight", old_weight);
+  f->dump_stream("last_purged_snaps_scrub") << last_purged_snaps_scrub;
 }
 
-void osd_xinfo_t::encode(ceph::buffer::list& bl) const
+void osd_xinfo_t::encode(ceph::buffer::list& bl, uint64_t enc_features) const
 {
-  ENCODE_START(3, 1, bl);
+  uint8_t v = 4;
+  if (!HAVE_FEATURE(enc_features, SERVER_OCTOPUS)) {
+    v = 3;
+  }
+  ENCODE_START(v, 1, bl);
   encode(down_stamp, bl);
   __u32 lp = laggy_probability * 0xfffffffful;
   encode(lp, bl);
   encode(laggy_interval, bl);
   encode(features, bl);
   encode(old_weight, bl);
+  if (v >= 4) {
+    encode(last_purged_snaps_scrub, bl);
+  }
   ENCODE_FINISH(bl);
 }
 
 void osd_xinfo_t::decode(ceph::buffer::list::const_iterator& bl)
 {
-  DECODE_START(3, bl);
+  DECODE_START(4, bl);
   decode(down_stamp, bl);
   __u32 lp;
   decode(lp, bl);
@@ -162,6 +170,9 @@ void osd_xinfo_t::decode(ceph::buffer::list::const_iterator& bl)
     decode(old_weight, bl);
   else
     old_weight = 0;
+  if (struct_v >= 4) {
+    decode(last_purged_snaps_scrub, bl);
+  }
   DECODE_FINISH(bl);
 }
 
@@ -180,7 +191,8 @@ ostream& operator<<(ostream& out, const osd_xinfo_t& xi)
   return out << "down_stamp " << xi.down_stamp
             << " laggy_probability " << xi.laggy_probability
             << " laggy_interval " << xi.laggy_interval
-            << " old_weight " << xi.old_weight;
+            << " old_weight " << xi.old_weight
+            << " last_purged_snaps_scrub " << xi.last_purged_snaps_scrub;
 }
 
 // ----------------------------------
@@ -481,7 +493,7 @@ void OSDMap::Incremental::encode_classic(ceph::buffer::list& bl, uint64_t featur
   encode(new_up_cluster, bl, features);
   encode(cluster_snapshot, bl);
   encode(new_uuid, bl);
-  encode(new_xinfo, bl);
+  encode(new_xinfo, bl, features);
   encode(new_hb_front_up, bl, features);
 }
 
@@ -622,7 +634,7 @@ void OSDMap::Incremental::encode(ceph::buffer::list& bl, uint64_t features) cons
     }
     encode(cluster_snapshot, bl);
     encode(new_uuid, bl);
-    encode(new_xinfo, bl);
+    encode(new_xinfo, bl, features);
     if (target_v < 7) {
       encode_addrvec_map_as_addr(new_hb_front_up, bl, features);
     } else {
@@ -2794,7 +2806,7 @@ void OSDMap::encode_classic(ceph::buffer::list& bl, uint64_t features) const
   encode(cluster_snapshot_epoch, bl);
   encode(cluster_snapshot, bl);
   encode(*osd_uuid, bl);
-  encode(osd_xinfo, bl);
+  encode(osd_xinfo, bl, features);
   encode(osd_addrs->hb_front_addrs, bl, features);
 }
 
@@ -2947,7 +2959,7 @@ void OSDMap::encode(ceph::buffer::list& bl, uint64_t features) const
     encode(cluster_snapshot_epoch, bl);
     encode(cluster_snapshot, bl);
     encode(*osd_uuid, bl);
-    encode(osd_xinfo, bl);
+    encode(osd_xinfo, bl, features);
     if (target_v < 7) {
       encode_addrvec_pvec_as_addr(osd_addrs->hb_front_addrs, bl, features);
     } else {
index b87ec8dc3c69a6acd8218e2be3652c8603cdaafc..41f3eea543824963619554c1d0c01841dd2e8c95 100644 (file)
@@ -92,16 +92,17 @@ struct osd_xinfo_t {
   __u32 laggy_interval;    ///< average interval between being marked laggy and recovering
   uint64_t features;       ///< features supported by this osd we should know about
   __u32 old_weight;        ///< weight prior to being auto marked out
+  utime_t last_purged_snaps_scrub; ///< last scrub of purged_snaps
 
   osd_xinfo_t() : laggy_probability(0), laggy_interval(0),
                   features(0), old_weight(0) {}
 
   void dump(ceph::Formatter *f) const;
-  void encode(ceph::buffer::list& bl) const;
+  void encode(ceph::buffer::list& bl, uint64_t features) const;
   void decode(ceph::buffer::list::const_iterator& bl);
   static void generate_test_instances(std::list<osd_xinfo_t*>& o);
 };
-WRITE_CLASS_ENCODER(osd_xinfo_t)
+WRITE_CLASS_ENCODER_FEATURES(osd_xinfo_t)
 
 std::ostream& operator<<(std::ostream& out, const osd_xinfo_t& xi);
 
index 211663d25760e9ff80543262397fe6f2d2cfbdd7..85b7b1b87cd730a76a3f6d0b622ccd073bc8ac77 100644 (file)
@@ -1,6 +1,6 @@
 #include "osd/OSDMap.h"
 TYPE(osd_info_t)
-TYPE(osd_xinfo_t)
+TYPE_FEATUREFUL(osd_xinfo_t)
 TYPE_FEATUREFUL_NOCOPY(OSDMap)
 TYPE_FEATUREFUL_STRAYDATA(OSDMap::Incremental)