From: Xiaoxi CHEN Date: Mon, 23 Apr 2018 17:58:11 +0000 (-0500) Subject: messages/MOSDMap: significant feature bits. X-Git-Tag: v12.2.6~44^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0a0d682c17c5ee1d05f8c9e4ff51174dc25face8;p=ceph.git messages/MOSDMap: significant feature bits. 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 (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 --- diff --git a/src/messages/MOSDMap.h b/src/messages/MOSDMap.h index 865642cf417..e77b4856cb9 100644 --- a/src/messages/MOSDMap.h +++ b/src/messages/MOSDMap.h @@ -26,6 +26,7 @@ class MOSDMap : public Message { public: uuid_d fsid; + uint64_t encode_features = 0; map maps; map 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::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); diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 4b7c9da8479..0b90e9506fa 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -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; diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 54ddcb81b31..66a0e2a6223 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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]);