From: Sage Weil Date: Fri, 31 Aug 2018 20:30:12 +0000 (-0500) Subject: osd/OSDMap: store last_up_change and last_in_change X-Git-Tag: v14.0.1~357^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d414f0b43a69f3c2db8e454d795be881496237c6;p=ceph.git osd/OSDMap: store last_up_change and last_in_change Signed-off-by: Sage Weil --- diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index 9b9b6a3ae91b..a1f6576da7df 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -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"); diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h index d3e8853f32d8..e66fa6523a1c 100644 --- a/src/osd/OSDMap.h +++ b/src/osd/OSDMap.h @@ -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 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.).