From d94115aa2a4bd92c56552e9fd11205d391a1c673 Mon Sep 17 00:00:00 2001 From: John Spray Date: Fri, 29 Apr 2016 20:12:20 +0100 Subject: [PATCH] mds: fix upgrades with replay daemons in map In the new world, a standby replay daemon which is actively replaying has its rank set. In the old world it did not: map this during the upgrade/downgrade paths in decode/encode. Fixes: http://tracker.ceph.com/issues/15591 Signed-off-by: John Spray --- src/mds/FSMap.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/mds/FSMap.cc b/src/mds/FSMap.cc index 531519626d83..c7967681eade 100644 --- a/src/mds/FSMap.cc +++ b/src/mds/FSMap.cc @@ -276,6 +276,15 @@ void FSMap::encode(bufferlist& bl, uint64_t features) const for (const auto p : standby_daemons) { full_mdsmap.mds_info[p.first] = p.second; } + + // Old MDSMaps don't set rank on standby replay daemons + for (auto &i : full_mdsmap.mds_info) { + auto &info = i.second; + if (info.state == MDSMap::STATE_STANDBY_REPLAY) { + info.rank = MDS_RANK_NONE; + } + } + full_mdsmap.encode(bl, features); } } @@ -412,7 +421,12 @@ void FSMap::decode(bufferlist::iterator& p) // Construct mds_roles, standby_daemons, and remove // standbys from the MDSMap in the Filesystem. - for (const auto &p : migrate_fs->mds_map.mds_info) { + for (auto &p : migrate_fs->mds_map.mds_info) { + if (p.second.state == MDSMap::STATE_STANDBY_REPLAY) { + // In legacy MDSMap, standby replay daemons don't have + // rank set, but since FSMap they do. + p.second.rank = p.second.standby_for_rank; + } if (p.second.rank == MDS_RANK_NONE) { standby_daemons[p.first] = p.second; standby_epochs[p.first] = epoch; -- 2.47.3