]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: set acting, upacting features from osdmap, not peers
authorSage Weil <sage@redhat.com>
Fri, 17 Jul 2015 18:33:31 +0000 (14:33 -0400)
committerSage Weil <sage@redhat.com>
Fri, 7 Aug 2015 14:16:02 +0000 (10:16 -0400)
Set in start_peering_interval based on the osdmap, so that it is defined
deterministically on primary, replica, and stray.

Note that peer features are still a primary-only construct.

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/PG.cc
src/osd/PG.h

index de15e95d2152ce7b10b0e888e067ec930e4f03ed..2fec729d26f567eeef0810144e04d8faed7f4f8c 100644 (file)
@@ -4702,11 +4702,26 @@ void PG::start_peering_interval(
     info.history.same_primary_since = osdmap->get_epoch();
   }
 
+  // initialize features
+  acting_features = CEPH_FEATURES_SUPPORTED_DEFAULT;
+  upacting_features = CEPH_FEATURES_SUPPORTED_DEFAULT;
+  for (vector<int>::iterator p = acting.begin(); p != acting.end(); ++p) {
+    uint64_t f = osdmap->get_xinfo(*p).features;
+    acting_features &= f;
+    upacting_features &= f;
+  }
+  for (vector<int>::iterator p = up.begin(); p != up.end(); ++p) {
+    upacting_features &= osdmap->get_xinfo(*p).features;
+  }
+
   dout(10) << " up " << oldup << " -> " << up 
           << ", acting " << oldacting << " -> " << acting 
           << ", acting_primary " << old_acting_primary << " -> " << new_acting_primary
           << ", up_primary " << old_up_primary << " -> " << new_up_primary
-          << ", role " << oldrole << " -> " << role << dendl; 
+          << ", role " << oldrole << " -> " << role
+          << ", features acting " << acting_features
+          << " upacting " << upacting_features
+          << dendl;
 
   // deactivate.
   state_clear(PG_STATE_ACTIVE);
@@ -6757,7 +6772,7 @@ PG::RecoveryState::GetInfo::GetInfo(my_context ctx)
   if (!prior_set.get())
     pg->build_prior(prior_set);
 
-  pg->reset_all_min_features();
+  pg->reset_min_peer_features();
   get_infos();
   if (peer_info_requested.empty() && !prior_set->pg_down) {
     post_event(GotInfo());
@@ -6837,18 +6852,6 @@ boost::statechart::result PG::RecoveryState::GetInfo::react(const MNotifyRec& in
       << hex << infoevt.features << dec << dendl;
     pg->apply_peer_features(infoevt.features);
 
-    if (std::find(pg->acting.begin(), pg->acting.end(), infoevt.from.osd) != pg->acting.end()) {
-      dout(20) << "Adding osd: " << infoevt.from.osd << " acting features: "
-       << hex << infoevt.features << dec << dendl;
-      pg->apply_acting_features(infoevt.features);
-    }
-
-    if (std::find(pg->up.begin(), pg->up.end(), infoevt.from.osd) != pg->up.end()) {
-      dout(20) << "Adding osd: " << infoevt.from.osd << " upacting features: "
-       << hex << infoevt.features << dec << dendl;
-      pg->apply_upacting_features(infoevt.features);
-    }
-
     // are we done getting everything?
     if (peer_info_requested.empty() && !prior_set->pg_down) {
       /*
index 840d4e0c328fb233df4ff01644c7160838cf2d5a..396221e5cddcd4deff9e4302fe87c97f6001f045 100644 (file)
@@ -2019,17 +2019,14 @@ public:
   const spg_t&      get_pgid() const { return pg_id; }
   int        get_nrep() const { return acting.size(); }
 
-  void reset_all_min_features() {
-     peer_features = CEPH_FEATURES_SUPPORTED_DEFAULT;
-     acting_features = CEPH_FEATURES_SUPPORTED_DEFAULT;
-     upacting_features = CEPH_FEATURES_SUPPORTED_DEFAULT;
+  void reset_min_peer_features() {
+    peer_features = CEPH_FEATURES_SUPPORTED_DEFAULT;
   }
   uint64_t get_min_peer_features() const { return peer_features; }
+  void apply_peer_features(uint64_t f) { peer_features &= f; }
+
   uint64_t get_min_acting_features() const { return acting_features; }
   uint64_t get_min_upacting_features() const { return upacting_features; }
-  void apply_peer_features(uint64_t f) { peer_features &= f; }
-  void apply_acting_features(uint64_t f) { acting_features &= f; }
-  void apply_upacting_features(uint64_t f) { upacting_features &= f; }
 
   /// true if we will sort hobjects bitwise for this pg interval
   bool get_sort_bitwise() const {