From 897d98f7c42f3d1fb34acc7c2708f86788ec0716 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 17 Jul 2015 14:33:31 -0400 Subject: [PATCH] osd: set acting, upacting features from osdmap, not peers 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 --- src/osd/PG.cc | 31 +++++++++++++++++-------------- src/osd/PG.h | 11 ++++------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index de15e95d2152c..2fec729d26f56 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -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::iterator p = acting.begin(); p != acting.end(); ++p) { + uint64_t f = osdmap->get_xinfo(*p).features; + acting_features &= f; + upacting_features &= f; + } + for (vector::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) { /* diff --git a/src/osd/PG.h b/src/osd/PG.h index 840d4e0c328fb..396221e5cddcd 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -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 { -- 2.39.5