From c1279d8ff8716a54622bf98bd29ce40faa2bf41d Mon Sep 17 00:00:00 2001 From: John Spray Date: Thu, 7 Apr 2016 12:37:08 +0100 Subject: [PATCH] mds: remove inc array from mdsmap Instead, use the MDSMap epochs to provide the `inc` that we populate into mds_info_t for use by the daemons. It is not necessary to respect the current value of inc in old maps, because the per-rank counters were necessarily lower numbers than the overall map epoch (incrementing the counters always corresponded to a map change). Fixes: http://tracker.ceph.com/issues/15399 Signed-off-by: John Spray (cherry picked from commit 30a375ebf814245fbbb5155fd39d8ff673f0a32a) --- src/mds/FSMap.cc | 5 +++-- src/mds/MDSMap.cc | 9 +++++++++ src/mds/MDSMap.h | 2 +- src/mon/MDSMonitor.cc | 1 - 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/mds/FSMap.cc b/src/mds/FSMap.cc index a20bb09b8cebe..9965e21d71346 100644 --- a/src/mds/FSMap.cc +++ b/src/mds/FSMap.cc @@ -334,7 +334,8 @@ void FSMap::decode(bufferlist::iterator& p) ::decode(legacy_mds_map.modified, p); ::decode(legacy_mds_map.tableserver, p); ::decode(legacy_mds_map.in, p); - ::decode(legacy_mds_map.inc, p); + std::map inc; // Legacy field, parse and drop + ::decode(inc, p); ::decode(legacy_mds_map.up, p); ::decode(legacy_mds_map.failed, p); ::decode(legacy_mds_map.stopped, p); @@ -663,7 +664,7 @@ void FSMap::promote( mds_map.failed.erase(assigned_rank); } info.rank = assigned_rank; - info.inc = ++mds_map.inc[assigned_rank]; + info.inc = epoch; mds_roles[standby_gid] = filesystem->fscid; // Update the rank state in Filesystem diff --git a/src/mds/MDSMap.cc b/src/mds/MDSMap.cc index f66fc7a85e445..304875c16b11d 100644 --- a/src/mds/MDSMap.cc +++ b/src/mds/MDSMap.cc @@ -469,6 +469,13 @@ void MDSMap::mds_info_t::decode(bufferlist::iterator& bl) void MDSMap::encode(bufferlist& bl, uint64_t features) const { + std::map inc; // Legacy field, fake it so that + // old-mon peers have something sane + // during upgrade + for (const auto rank : in) { + inc.insert(std::make_pair(rank, epoch)); + } + if ((features & CEPH_FEATURE_PGID64) == 0) { __u16 v = 2; ::encode(v, bl); @@ -573,6 +580,8 @@ void MDSMap::encode(bufferlist& bl, uint64_t features) const void MDSMap::decode(bufferlist::iterator& p) { + std::map inc; // Legacy field, parse and drop + cached_up_features = 0; DECODE_START_LEGACY_COMPAT_LEN_16(5, 4, 4, p); ::decode(epoch, p); diff --git a/src/mds/MDSMap.h b/src/mds/MDSMap.h index bb69a75f9d5ef..2b0fb03499deb 100644 --- a/src/mds/MDSMap.h +++ b/src/mds/MDSMap.h @@ -203,7 +203,7 @@ class MDSMap { mds_rank_t max_mds; /* The maximum number of active MDSes. Also, the maximum rank. */ std::set in; // currently defined cluster - std::map inc; // most recent incarnation. + // which ranks are failed, stopped, damaged (i.e. not held by a daemon) std::set failed, stopped, damaged; std::map up; // who is in those roles diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index 00f06a0207f49..c672e0a6b4263 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -1732,7 +1732,6 @@ int MDSMonitor::management_command( // Carry forward what makes sense new_fs->fscid = fs->fscid; - new_fs->mds_map.inc = fs->mds_map.inc; new_fs->mds_map.inline_data_enabled = fs->mds_map.inline_data_enabled; new_fs->mds_map.max_mds = g_conf->max_mds; new_fs->mds_map.data_pools = fs->mds_map.data_pools;