]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSDMap: store last_up_change and last_in_change
authorSage Weil <sage@redhat.com>
Fri, 31 Aug 2018 20:30:12 +0000 (15:30 -0500)
committerSage Weil <sage@redhat.com>
Thu, 6 Sep 2018 15:28:45 +0000 (10:28 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSDMap.cc
src/osd/OSDMap.h

index 9b9b6a3ae91b6b980767e8bd00c80849a6e9068f..a1f6576da7df560ce0546a6d9ed9a3a5d37972a7 100644 (file)
@@ -514,7 +514,7 @@ void OSDMap::Incremental::encode(bufferlist& bl, uint64_t features) const
   ENCODE_START(8, 7, bl);
 
   {
-    uint8_t v = 7;
+    uint8_t v = 8;
     if (!HAVE_FEATURE(features, SERVER_LUMINOUS)) {
       v = 3;
     } else if (!HAVE_FEATURE(features, SERVER_MIMIC)) {
@@ -566,6 +566,10 @@ void OSDMap::Incremental::encode(bufferlist& bl, uint64_t features) const
       encode(new_removed_snaps, bl);
       encode(new_purged_snaps, bl);
     }
+    if (v >= 8) {
+      encode(new_last_up_change, bl);
+      encode(new_last_in_change, bl);
+    }
     ENCODE_FINISH(bl); // client-usable data
   }
 
@@ -763,7 +767,7 @@ void OSDMap::Incremental::decode(bufferlist::const_iterator& bl)
     return;
   }
   {
-    DECODE_START(7, bl); // client-usable data
+    DECODE_START(8, bl); // client-usable data
     decode(fsid, bl);
     decode(epoch, bl);
     decode(modified, bl);
@@ -810,6 +814,10 @@ void OSDMap::Incremental::decode(bufferlist::const_iterator& bl)
       decode(new_removed_snaps, bl);
       decode(new_purged_snaps, bl);
     }
+    if (struct_v >= 8) {
+      decode(new_last_up_change, bl);
+      decode(new_last_in_change, bl);
+    }
     DECODE_FINISH(bl); // client-usable data
   }
 
@@ -904,6 +912,8 @@ void OSDMap::Incremental::dump(Formatter *f) const
   f->dump_int("epoch", epoch);
   f->dump_stream("fsid") << fsid;
   f->dump_stream("modified") << modified;
+  f->dump_stream("new_last_up_change") << new_last_up_change;
+  f->dump_stream("new_last_in_change") << new_last_in_change;
   f->dump_int("new_pool_max", new_pool_max);
   f->dump_int("new_flags", new_flags);
   f->dump_float("new_full_ratio", new_full_ratio);
@@ -1910,6 +1920,13 @@ int OSDMap::apply_incremental(const Incremental &inc)
     }
   }
 
+  if (inc.new_last_up_change != utime_t()) {
+    last_up_change = inc.new_last_up_change;
+  }
+  if (inc.new_last_in_change != utime_t()) {
+    last_in_change = inc.new_last_in_change;
+  }
+
   for (const auto &pname : inc.new_pool_names) {
     auto pool_name_entry = pool_name.find(pname.first);
     if (pool_name_entry != pool_name.end()) {
@@ -2640,7 +2657,7 @@ void OSDMap::encode(bufferlist& bl, uint64_t features) const
   {
     // NOTE: any new encoding dependencies must be reflected by
     // SIGNIFICANT_FEATURES
-    uint8_t v = 8;
+    uint8_t v = 9;
     if (!HAVE_FEATURE(features, SERVER_LUMINOUS)) {
       v = 3;
     } else if (!HAVE_FEATURE(features, SERVER_MIMIC)) {
@@ -2718,6 +2735,10 @@ void OSDMap::encode(bufferlist& bl, uint64_t features) const
       encode(new_removed_snaps, bl);
       encode(new_purged_snaps, bl);
     }
+    if (v >= 9) {
+      encode(last_up_change, bl);
+      encode(last_in_change, bl);
+    }
     ENCODE_FINISH(bl); // client-usable data
   }
 
@@ -2951,7 +2972,7 @@ void OSDMap::decode(bufferlist::const_iterator& bl)
    * Since we made it past that hurdle, we can use our normal paths.
    */
   {
-    DECODE_START(8, bl); // client-usable data
+    DECODE_START(9, bl); // client-usable data
     // base
     decode(fsid, bl);
     decode(epoch, bl);
@@ -3013,6 +3034,10 @@ void OSDMap::decode(bufferlist::const_iterator& bl)
       decode(new_removed_snaps, bl);
       decode(new_purged_snaps, bl);
     }
+    if (struct_v >= 9) {
+      decode(last_up_change, bl);
+      decode(last_in_change, bl);
+    }
     DECODE_FINISH(bl); // client-usable data
   }
 
@@ -3136,6 +3161,8 @@ void OSDMap::dump(Formatter *f) const
   f->dump_stream("fsid") << get_fsid();
   f->dump_stream("created") << get_created();
   f->dump_stream("modified") << get_modified();
+  f->dump_stream("last_up_change") << last_up_change;
+  f->dump_stream("last_in_change") << last_in_change;
   f->dump_string("flags", get_flag_string());
   f->dump_unsigned("flags_num", flags);
   f->open_array_section("flags_set");
index d3e8853f32d8180f9ded4e5f53bf8bcff3723dc9..e66fa6523a1c26836d3aca62d7617532f2735b02 100644 (file)
@@ -407,6 +407,8 @@ public:
 
     int8_t new_require_min_compat_client = -1;
 
+    utime_t new_last_up_change, new_last_in_change;
+
     mutable bool have_crc;      ///< crc values are defined
     uint32_t full_crc;  ///< crc of the resulting OSDMap
     mutable uint32_t inc_crc;   ///< crc of this incremental
@@ -506,6 +508,8 @@ private:
   int32_t max_osd;
   vector<uint32_t> osd_state;
 
+  utime_t last_up_change, last_in_change;
+
   // These features affect OSDMap[::Incremental] encoding, or the
   // encoding of some type embedded therein (CrushWrapper, something
   // from osd_types, etc.).