]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix upgrades with replay daemons in map 8971/head
authorJohn Spray <john.spray@redhat.com>
Fri, 29 Apr 2016 19:12:20 +0000 (20:12 +0100)
committerAbhishek Varshney <abhishek.varshney@flipkart.com>
Fri, 6 May 2016 14:30:04 +0000 (20:00 +0530)
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 <john.spray@redhat.com>
(cherry picked from commit d94115aa2a4bd92c56552e9fd11205d391a1c673)

src/mds/FSMap.cc

index 531519626d839aef80ea1ad1461baa0e1a9d0f9d..c7967681eade2a63d52e9b93e9f129548892a941 100644 (file)
@@ -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;