From: Greg Farnum Date: Thu, 28 Oct 2021 22:00:27 +0000 (+0000) Subject: osdmap: store new range_blocklist, updated as we do the existing blocklist X-Git-Tag: v17.2.1~15^2~23 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=8c68d5ccebbf12be57fe2ef6361df80664b5aee0;p=ceph.git osdmap: store new range_blocklist, updated as we do the existing blocklist Signed-off-by: Greg Farnum (cherry picked from commit c0b87d9aca6f61ffe726ce3407059c527b319cbe) --- diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index 8ef6a1607ad67..13444abe584e1 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -648,7 +648,7 @@ void OSDMap::Incremental::encode(ceph::buffer::list& bl, uint64_t features) cons } { - uint8_t target_v = 9; // if bumping this, be aware of stretch_mode target_v 10! + uint8_t target_v = 9; // if bumping this, be aware of range_blocklist 11 if (!HAVE_FEATURE(features, SERVER_LUMINOUS)) { target_v = 2; } else if (!HAVE_FEATURE(features, SERVER_NAUTILUS)) { @@ -657,6 +657,10 @@ void OSDMap::Incremental::encode(ceph::buffer::list& bl, uint64_t features) cons if (change_stretch_mode) { target_v = std::max((uint8_t)10, target_v); } + if (!new_range_blocklist.empty() || + !old_range_blocklist.empty()) { + target_v = std::max((uint8_t)11, target_v); + } ENCODE_START(target_v, 1, bl); // extended, osd-only data if (target_v < 7) { encode_addrvec_map_as_addr(new_hb_back_up, bl, features); @@ -706,6 +710,10 @@ void OSDMap::Incremental::encode(ceph::buffer::list& bl, uint64_t features) cons encode(new_stretch_mode_bucket, bl); encode(stretch_mode_enabled, bl); } + if (target_v >= 11) { + encode(new_range_blocklist, bl, features); + encode(old_range_blocklist, bl, features); + } ENCODE_FINISH(bl); // osd-only data } @@ -980,7 +988,10 @@ void OSDMap::Incremental::decode(ceph::buffer::list::const_iterator& bl) decode(new_stretch_mode_bucket, bl); decode(stretch_mode_enabled, bl); } - + if (struct_v >= 11) { + decode(new_range_blocklist, bl); + decode(old_range_blocklist, bl); + } DECODE_FINISH(bl); // osd-only data } @@ -1226,6 +1237,17 @@ void OSDMap::Incremental::dump(Formatter *f) const for (const auto &blist : old_blocklist) f->dump_stream("addr") << blist; f->close_section(); + f->open_array_section("new_range_blocklist"); + for (const auto &blist : new_range_blocklist) { + stringstream ss; + ss << blist.first; + f->dump_stream(ss.str().c_str()) << blist.second; + } + f->close_section(); + f->open_array_section("old_range_blocklist"); + for (const auto &blist : old_range_blocklist) + f->dump_stream("addr") << blist; + f->close_section(); f->open_array_section("new_xinfo"); for (const auto &xinfo : new_xinfo) { @@ -2287,6 +2309,14 @@ int OSDMap::apply_incremental(const Incremental &inc) for (const auto &addr : inc.old_blocklist) blocklist.erase(addr); + if (!inc.new_range_blocklist.empty()) { + range_blocklist.insert(inc.new_range_blocklist.begin(), + inc.new_range_blocklist.end()); + new_blocklist_entries = true; + } + for (const auto &addr : inc.old_range_blocklist) + range_blocklist.erase(addr); + for (auto& i : inc.new_crush_node_flags) { if (i.second) { crush_node_flags[i.first] = i.second; @@ -3037,7 +3067,7 @@ void OSDMap::encode(ceph::buffer::list& bl, uint64_t features) const { // NOTE: any new encoding dependencies must be reflected by // SIGNIFICANT_FEATURES - uint8_t target_v = 9; // when bumping this, be aware of stretch_mode target_v 10! + uint8_t target_v = 9; // when bumping this, be aware of range blocklist if (!HAVE_FEATURE(features, SERVER_LUMINOUS)) { target_v = 1; } else if (!HAVE_FEATURE(features, SERVER_MIMIC)) { @@ -3048,6 +3078,9 @@ void OSDMap::encode(ceph::buffer::list& bl, uint64_t features) const if (stretch_mode_enabled) { target_v = std::max((uint8_t)10, target_v); } + if (!range_blocklist.empty()) { + target_v = std::max((uint8_t)11, target_v); + } ENCODE_START(target_v, 1, bl); // extended, osd-only data if (target_v < 7) { encode_addrvec_pvec_as_addr(osd_addrs->hb_back_addrs, bl, features); @@ -3103,6 +3136,9 @@ void OSDMap::encode(ceph::buffer::list& bl, uint64_t features) const encode(recovering_stretch_mode, bl); encode(stretch_mode_bucket, bl); } + if (target_v >= 11) { + ::encode(range_blocklist, bl, features); + } ENCODE_FINISH(bl); // osd-only data } @@ -3442,6 +3478,9 @@ void OSDMap::decode(ceph::buffer::list::const_iterator& bl) recovering_stretch_mode = 0; stretch_mode_bucket = 0; } + if (struct_v >= 11) { + decode(range_blocklist, bl); + } DECODE_FINISH(bl); // osd-only data } @@ -3654,6 +3693,13 @@ void OSDMap::dump(Formatter *f) const f->dump_stream(ss.str().c_str()) << addr.second; } f->close_section(); + f->open_object_section("range_blocklist"); + for (const auto &addr : range_blocklist) { + stringstream ss; + ss << addr.first; + f->dump_stream(ss.str().c_str()) << addr.second; + } + f->close_section(); dump_erasure_code_profiles(erasure_code_profiles, f); @@ -3918,6 +3964,8 @@ void OSDMap::print(ostream& out) const for (const auto &addr : blocklist) out << "blocklist " << addr.first << " expires " << addr.second << "\n"; + for (const auto &addr : range_blocklist) + out << "range blocklist " << addr.first << " expires " << addr.second << "\n"; } class OSDTreePlainDumper : public CrushTreeDumper::Dumper { diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h index 4cf02756c1d85..3969a9ea90cdc 100644 --- a/src/osd/OSDMap.h +++ b/src/osd/OSDMap.h @@ -397,6 +397,8 @@ public: mempool::osdmap::map new_blocklist; mempool::osdmap::vector old_blocklist; + mempool::osdmap::map new_range_blocklist; + mempool::osdmap::vector old_range_blocklist; mempool::osdmap::map new_hb_back_up; mempool::osdmap::map new_hb_front_up; @@ -583,6 +585,7 @@ private: mempool::osdmap::vector osd_xinfo; mempool::osdmap::unordered_map blocklist; + mempool::osdmap::map range_blocklist; /// queue of snaps to remove mempool::osdmap::map removed_snaps_queue;