From: Greg Farnum Date: Tue, 21 Jul 2020 17:04:32 +0000 (+0000) Subject: osd: conditionally encode stretch state in pg_pool_t, do not require new compat X-Git-Tag: v16.1.0~1053^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ddfda9274c45e9dce1b2b3a58cac91fba488419b;p=ceph.git osd: conditionally encode stretch state in pg_pool_t, do not require new compat This struct gets sent out to clients as well as OSDs, and we need them to be able to decode it without crashing/failing. So we can't require it, and happily the OSDs which might act on it will be gated by the OSDMap. Additionally, we don't want older servers to fail OSDMap crc checks, so don't encode the stretch data members if they aren't in use. Signed-off-by: Greg Farnum --- diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 198fe89d7822..a6cd635e9a10 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -1942,9 +1942,10 @@ void pg_pool_t::encode(ceph::buffer::list& bl, uint64_t features) const v = 26; } else if (!HAVE_FEATURE(features, SERVER_NAUTILUS)) { v = 27; + } else if (!is_stretch_pool()) { + v = 29; } - uint8_t new_compat = 0; ENCODE_START(v, 5, bl); encode(type, bl); encode(size, bl); @@ -2033,20 +2034,13 @@ void pg_pool_t::encode(ceph::buffer::list& bl, uint64_t features) const if (v >= 29) { encode(last_pg_merge_meta, bl); } - if (peering_crush_bucket_barrier != 0 || - peering_crush_bucket_target != 0 || - peering_crush_bucket_count !=0 || - peering_crush_mandatory_member != CRUSH_ITEM_NONE) { - ceph_assert(v >= 30); - new_compat = 30; - } if (v >= 30) { encode(peering_crush_bucket_count, bl); encode(peering_crush_bucket_target, bl); encode(peering_crush_bucket_barrier, bl); encode(peering_crush_mandatory_member, bl); } - ENCODE_FINISH_NEW_COMPAT(bl, new_compat); + ENCODE_FINISH(bl); } void pg_pool_t::decode(ceph::buffer::list::const_iterator& bl)