1
0
mirror of https://github.com/ceph/ceph synced 2025-04-01 23:02:17 +00:00

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 <xiaoxchen@ebay.com>
This commit is contained in:
Xiaoxi CHEN 2018-04-23 12:58:11 -05:00 committed by Sage Weil
parent d84a49e262
commit dc7a219468
3 changed files with 21 additions and 19 deletions

View File

@ -27,6 +27,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;
@ -63,13 +64,12 @@ class MOSDMap : public Message {
MOSDMap() : Message(CEPH_MSG_OSD_MAP, HEAD_VERSION, COMPAT_VERSION) { }
MOSDMap(const uuid_d &f)
MOSDMap(const uuid_d &f, const uint64_t features)
: Message(CEPH_MSG_OSD_MAP, HEAD_VERSION, COMPAT_VERSION),
fsid(f),
fsid(f), encode_features(features),
oldest_map(0), newest_map(0) { }
private:
~MOSDMap() override {}
public:
// marshalling
void decode_payload() override {
@ -93,12 +93,8 @@ public:
header.version = HEAD_VERSION;
header.compat_version = COMPAT_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
@ -117,13 +113,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
@ -131,17 +129,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);

View File

@ -2055,7 +2055,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;
@ -3341,7 +3341,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();
@ -3351,7 +3351,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();
@ -3429,7 +3429,7 @@ void OSDMonitor::send_incremental(epoch_t first,
}
if (first < get_first_committed()) {
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();

View File

@ -1299,7 +1299,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;
@ -1339,7 +1340,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]);