From de041241ada0b58aa5a5e143edbeac61bd54ddcd Mon Sep 17 00:00:00 2001 From: David Zafman Date: Thu, 4 Jun 2015 16:15:29 -0700 Subject: [PATCH] osd: Add tracking of acting_features and upacting_features Use most appropriate feature intersection depending on context Signed-off-by: David Zafman --- src/osd/PG.cc | 28 ++++++++++++++++++++++------ src/osd/PG.h | 12 +++++++++++- src/osd/ReplicatedPG.cc | 2 +- src/osd/ReplicatedPG.h | 2 +- 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index bf8dcdfeeff9e..e0bad7889882c 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -217,7 +217,9 @@ PG::PG(OSDService *o, OSDMapRef curmap, active_pushes(0), recovery_state(this), pg_id(p), - peer_features(CEPH_FEATURES_SUPPORTED_DEFAULT) + peer_features(CEPH_FEATURES_SUPPORTED_DEFAULT), + acting_features(CEPH_FEATURES_SUPPORTED_DEFAULT), + upacting_features(CEPH_FEATURES_SUPPORTED_DEFAULT) { #ifdef PG_DEBUG_REFS osd->add_pgid(p, this); @@ -4000,7 +4002,7 @@ void PG::chunky_scrub(ThreadPool::TPHandle &handle) osd->clog->info(oss); } - if (peer_features & CEPH_FEATURE_OSD_OBJECT_DIGEST) + if (get_min_acting_features() & CEPH_FEATURE_OSD_OBJECT_DIGEST) scrubber.seed = -1; // better, and enables oi digest checks else scrubber.seed = 0; // compat @@ -4249,7 +4251,7 @@ void PG::scrub_compare_maps() } // can we relate scrub digests to oi digests? - bool okseed = (get_min_peer_features() & CEPH_FEATURE_OSD_OBJECT_DIGEST); + bool okseed = (get_min_upacting_features() & CEPH_FEATURE_OSD_OBJECT_DIGEST); assert(okseed == (scrubber.seed == 0xffffffff)); get_pgbackend()->be_compare_scrubmaps( @@ -6905,7 +6907,7 @@ PG::RecoveryState::GetInfo::GetInfo(my_context ctx) if (!prior_set.get()) pg->build_prior(prior_set); - pg->reset_peer_features(); + pg->reset_all_min_features(); get_infos(); if (peer_info_requested.empty() && !prior_set->pg_down) { post_event(GotInfo()); @@ -6981,10 +6983,22 @@ boost::statechart::result PG::RecoveryState::GetInfo::react(const MNotifyRec& in } get_infos(); } - dout(20) << "Adding osd: " << infoevt.from.osd << " features: " + dout(20) << "Adding osd: " << infoevt.from.osd << " peer features: " << 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) { /* @@ -7042,7 +7056,9 @@ boost::statechart::result PG::RecoveryState::GetInfo::react(const MNotifyRec& in break; } } - dout(20) << "Common features: " << hex << pg->get_min_peer_features() << dec << dendl; + dout(20) << "Common peer features: " << hex << pg->get_min_peer_features() << dec << dendl; + dout(20) << "Common acting features: " << hex << pg->get_min_acting_features() << dec << dendl; + dout(20) << "Common upacting features: " << hex << pg->get_min_upacting_features() << dec << dendl; post_event(GotInfo()); } } diff --git a/src/osd/PG.h b/src/osd/PG.h index a6af4969fb6a8..f2ac76a16f0e3 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -2012,14 +2012,24 @@ public: PG& operator=(const PG& rhs); const spg_t pg_id; uint64_t peer_features; + uint64_t acting_features; + uint64_t upacting_features; public: const spg_t& get_pgid() const { return pg_id; } int get_nrep() const { return acting.size(); } - void reset_peer_features() { peer_features = CEPH_FEATURES_SUPPORTED_DEFAULT; } + void reset_all_min_features() { + peer_features = CEPH_FEATURES_SUPPORTED_DEFAULT; + acting_features = CEPH_FEATURES_SUPPORTED_DEFAULT; + upacting_features = CEPH_FEATURES_SUPPORTED_DEFAULT; + } uint64_t get_min_peer_features() const { return peer_features; } + 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; } void init_primary_up_acting( const vector &newup, diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index c5f39b817e068..fa951167711e4 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -4118,7 +4118,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector& ops) ++ctx->num_write; { tracepoint(osd, do_osd_op_pre_setallochint, soid.oid.name.c_str(), soid.snap.val, op.alloc_hint.expected_object_size, op.alloc_hint.expected_write_size); - if (!(get_min_peer_features() & CEPH_FEATURE_OSD_SET_ALLOC_HINT)) { + if (!(get_min_upacting_features() & CEPH_FEATURE_OSD_SET_ALLOC_HINT)) { result = -EOPNOTSUPP; break; } diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index 5bc36e49bac35..9e23023593796 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -452,7 +452,7 @@ public: } bool transaction_use_tbl() { - uint64_t min_features = get_min_peer_features(); + uint64_t min_features = get_min_upacting_features(); return !(min_features & CEPH_FEATURE_OSD_TRANSACTION_MAY_LAYOUT); } -- 2.39.5