]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: conditionally encode stretch state in pg_pool_t, do not require new compat
authorGreg Farnum <gfarnum@redhat.com>
Tue, 21 Jul 2020 17:04:32 +0000 (17:04 +0000)
committerGreg Farnum <gfarnum@redhat.com>
Tue, 21 Jul 2020 17:59:15 +0000 (17:59 +0000)
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 <gfarnum@redhat.com>
src/osd/osd_types.cc

index 198fe89d7822458e81662f3153e8d12cf96cb4a2..a6cd635e9a10aa7a55a4077407da5c057e1cbfc8 100644 (file)
@@ -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)