]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
messages/MOSDMap: significant feature bits.
authorXiaoxi CHEN <xiaoxchen@ebay.com>
Mon, 23 Apr 2018 17:58:11 +0000 (12:58 -0500)
committerXiaoxi CHEN <xiaoxchen@ebay.com>
Mon, 14 May 2018 06:43:27 +0000 (23:43 -0700)
1. MOSDMap go with features indicating the features
this map encoded for.

2. Only reencode if significant bits mismatch between
target features and my features.

also update mon/OSDMonitor and osd/OSDService to adopt this change.

Signed-off-by: Xiaoxi CHEN <xiaoxchen@ebay.com>
(cherry picked from commit dc7a219468b5a9313b5a1d660c1b61e1e35b718d)

Conflicts:
src/messages/MOSDMap.h
            drop COMPACT_VERSION
src/mon/OSDMonitor.cc
            drop get_removed_snaps_range
   Both introduced by post-luminous commit 49833c3bb264949b8126796997a95a95b50af411

src/messages/MOSDMap.h
src/mon/OSDMonitor.cc
src/osd/OSD.cc

index 865642cf417c30f487fb3a698946a20e86f8075f..e77b4856cb9f478088794b16dddd2cdda4909e22 100644 (file)
@@ -26,6 +26,7 @@ class MOSDMap : public Message {
 
  public:
   uuid_d fsid;
+  uint64_t encode_features = 0;
   map<epoch_t, bufferlist> maps;
   map<epoch_t, bufferlist> incremental_maps;
   epoch_t oldest_map =0, newest_map = 0;
@@ -57,13 +58,12 @@ class MOSDMap : public Message {
 
 
   MOSDMap() : Message(CEPH_MSG_OSD_MAP, HEAD_VERSION) { }
-  MOSDMap(const uuid_d &f)
+  MOSDMap(const uuid_d &f, const uint64_t features)
     : Message(CEPH_MSG_OSD_MAP, HEAD_VERSION),
-      fsid(f),
+      fsid(f), encode_features(features),
       oldest_map(0), newest_map(0) { }
 private:
   ~MOSDMap() override {}
-
 public:
   // marshalling
   void decode_payload() override {
@@ -82,12 +82,8 @@ public:
   void encode_payload(uint64_t features) override {
     header.version = HEAD_VERSION;
     ::encode(fsid, payload);
-    if ((features & CEPH_FEATURE_PGID64) == 0 ||
-       (features & CEPH_FEATURE_PGPOOL3) == 0 ||
-       (features & CEPH_FEATURE_OSDENC) == 0 ||
-        (features & CEPH_FEATURE_OSDMAP_ENC) == 0 ||
-       (features & CEPH_FEATURE_MSG_ADDR2) == 0 ||
-       !HAVE_FEATURE(features, SERVER_LUMINOUS)) {
+    if (OSDMap::get_significant_features(encode_features) !=
+         OSDMap::get_significant_features(features)) {
       if ((features & CEPH_FEATURE_PGID64) == 0 ||
          (features & CEPH_FEATURE_PGPOOL3) == 0)
        header.version = 1;  // old old_client version
@@ -105,13 +101,15 @@ public:
        OSDMap::Incremental inc;
        bufferlist::iterator q = p->second.begin();
        inc.decode(q);
+       // always encode with subset of osdmaps canonical features
+       uint64_t f = inc.encode_features & features;
        p->second.clear();
        if (inc.fullmap.length()) {
          // embedded full map?
          OSDMap m;
          m.decode(inc.fullmap);
          inc.fullmap.clear();
-         m.encode(inc.fullmap, features | CEPH_FEATURE_RESERVED);
+         m.encode(inc.fullmap, f | CEPH_FEATURE_RESERVED);
        }
        if (inc.crush.length()) {
          // embedded crush map
@@ -119,17 +117,19 @@ public:
          auto p = inc.crush.begin();
          c.decode(p);
          inc.crush.clear();
-         c.encode(inc.crush, features);
+         c.encode(inc.crush, f);
        }
-       inc.encode(p->second, features | CEPH_FEATURE_RESERVED);
+       inc.encode(p->second, f | CEPH_FEATURE_RESERVED);
       }
       for (map<epoch_t,bufferlist>::iterator p = maps.begin();
           p != maps.end();
           ++p) {
        OSDMap m;
        m.decode(p->second);
+       // always encode with subset of osdmaps canonical features
+       uint64_t f = m.get_encoding_features() & features;
        p->second.clear();
-       m.encode(p->second, features | CEPH_FEATURE_RESERVED);
+       m.encode(p->second, f | CEPH_FEATURE_RESERVED);
       }
     }
     ::encode(incremental_maps, payload);
index 4b7c9da8479130ed4571b3ed931230593d342b98..0b90e9506fac3b6a2a5dd199bb035cf3645d20a0 100644 (file)
@@ -1768,7 +1768,7 @@ bool OSDMonitor::preprocess_get_osdmap(MonOpRequestRef op)
     features = m->get_session()->con_features;
 
   dout(10) << __func__ << " " << *m << dendl;
-  MOSDMap *reply = new MOSDMap(mon->monmap->fsid);
+  MOSDMap *reply = new MOSDMap(mon->monmap->fsid, features);
   epoch_t first = get_first_committed();
   epoch_t last = osdmap.get_epoch();
   int max = g_conf->osd_map_message_max;
@@ -3130,7 +3130,7 @@ void OSDMonitor::send_latest(MonOpRequestRef op, epoch_t start)
 
 MOSDMap *OSDMonitor::build_latest_full(uint64_t features)
 {
-  MOSDMap *r = new MOSDMap(mon->monmap->fsid);
+  MOSDMap *r = new MOSDMap(mon->monmap->fsid, features);
   get_version_full(osdmap.get_epoch(), features, r->maps[osdmap.get_epoch()]);
   r->oldest_map = get_first_committed();
   r->newest_map = osdmap.get_epoch();
@@ -3140,7 +3140,7 @@ MOSDMap *OSDMonitor::build_latest_full(uint64_t features)
 MOSDMap *OSDMonitor::build_incremental(epoch_t from, epoch_t to, uint64_t features)
 {
   dout(10) << "build_incremental [" << from << ".." << to << "] with features " << std::hex << features << dendl;
-  MOSDMap *m = new MOSDMap(mon->monmap->fsid);
+  MOSDMap *m = new MOSDMap(mon->monmap->fsid, features);
   m->oldest_map = get_first_committed();
   m->newest_map = osdmap.get_epoch();
 
@@ -3228,7 +3228,7 @@ void OSDMonitor::send_incremental(epoch_t first,
     dout(20) << "send_incremental starting with base full "
             << first << " " << bl.length() << " bytes" << dendl;
 
-    MOSDMap *m = new MOSDMap(osdmap.get_fsid());
+    MOSDMap *m = new MOSDMap(osdmap.get_fsid(), features);
     m->oldest_map = get_first_committed();
     m->newest_map = osdmap.get_epoch();
     m->maps[first] = bl;
index 54ddcb81b3191ea89e6015dc1596a78df5115c2a..66a0e2a6223370279cd0873dbac9c94034b82954 100644 (file)
@@ -1411,7 +1411,8 @@ void OSDService::got_stop_ack()
 MOSDMap *OSDService::build_incremental_map_msg(epoch_t since, epoch_t to,
                                                OSDSuperblock& sblock)
 {
-  MOSDMap *m = new MOSDMap(monc->get_fsid());
+  MOSDMap *m = new MOSDMap(monc->get_fsid(),
+                          osdmap->get_encoding_features());
   m->oldest_map = max_oldest_map;
   m->newest_map = sblock.newest_map;
 
@@ -1451,7 +1452,8 @@ void OSDService::send_incremental_map(epoch_t since, Connection *con,
     OSDSuperblock sblock(get_superblock());
     if (since < sblock.oldest_map) {
       // just send latest full map
-      MOSDMap *m = new MOSDMap(monc->get_fsid());
+      MOSDMap *m = new MOSDMap(monc->get_fsid(),
+                              osdmap->get_encoding_features());
       m->oldest_map = max_oldest_map;
       m->newest_map = sblock.newest_map;
       get_map_bl(to, m->maps[to]);