diff --git a/src/osd/PG.cc b/src/osd/PG.cc index a27ca998869..85d13f5260c 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -186,9 +186,6 @@ PG::PG(OSDService *o, OSDMapRef curmap, this, this), pg_whoami(recovery_state.pg_whoami), - upset(recovery_state.upset), - actingset(recovery_state.actingset), - acting_recovery_backfill(recovery_state.acting_recovery_backfill), info(recovery_state.info), pg_log(recovery_state.pg_log), last_update_ondisk(recovery_state.last_update_ondisk), @@ -2109,8 +2106,8 @@ void PG::clear_scrub_reserved() void PG::scrub_reserve_replicas() { ceph_assert(recovery_state.get_backfill_targets().empty()); - for (set::iterator i = acting_recovery_backfill.begin(); - i != acting_recovery_backfill.end(); + for (set::iterator i = get_acting_recovery_backfill().begin(); + i != get_acting_recovery_backfill().end(); ++i) { if (*i == pg_whoami) continue; dout(10) << "scrub requesting reserve from osd." << *i << dendl; @@ -2126,8 +2123,8 @@ void PG::scrub_reserve_replicas() void PG::scrub_unreserve_replicas() { ceph_assert(recovery_state.get_backfill_targets().empty()); - for (set::iterator i = acting_recovery_backfill.begin(); - i != acting_recovery_backfill.end(); + for (set::iterator i = get_acting_recovery_backfill().begin(); + i != get_acting_recovery_backfill().end(); ++i) { if (*i == pg_whoami) continue; dout(10) << "scrub requesting unreserve from osd." << *i << dendl; @@ -2836,8 +2833,8 @@ void PG::chunky_scrub(ThreadPool::TPHandle &handle) scrubber.waiting_on_whom.insert(pg_whoami); // request maps from replicas - for (set::iterator i = acting_recovery_backfill.begin(); - i != acting_recovery_backfill.end(); + for (set::iterator i = get_acting_recovery_backfill().begin(); + i != get_acting_recovery_backfill().end(); ++i) { if (*i == pg_whoami) continue; _request_scrub_map(*i, scrubber.subset_last_update, @@ -3066,7 +3063,7 @@ void PG::scrub_compare_maps() map maps; maps[pg_whoami] = &scrubber.primary_scrubmap; - for (const auto& i : acting_recovery_backfill) { + for (const auto& i : get_acting_recovery_backfill()) { if (i == pg_whoami) continue; dout(2) << __func__ << " replica " << i << " has " << scrubber.received_maps[i].objects.size() diff --git a/src/osd/PG.h b/src/osd/PG.h index 9f6a682a9a2..fee9b904e6d 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -183,9 +183,6 @@ protected: * Peering state information being moved to PeeringState */ pg_shard_t pg_whoami; - set &upset; - set &actingset; - set &acting_recovery_backfill; pg_info_t &info; PGLog &pg_log; eversion_t &last_update_ondisk; @@ -322,6 +319,9 @@ public: const vector get_acting() const { return recovery_state.get_acting(); } + const set &get_actingset() const { + return recovery_state.get_actingset(); + } int get_acting_primary() const { return recovery_state.get_acting_primary(); } @@ -340,6 +340,9 @@ public: bool is_acting_recovery_backfill(pg_shard_t osd) const { return recovery_state.is_acting_recovery_backfill(osd); } + const set &get_acting_recovery_backfill() const { + return recovery_state.get_acting_recovery_backfill(); + } bool is_acting(pg_shard_t osd) const { return recovery_state.is_acting(osd); } diff --git a/src/osd/PeeringState.h b/src/osd/PeeringState.h index 696e10b4d3f..1fb8e5f98d5 100644 --- a/src/osd/PeeringState.h +++ b/src/osd/PeeringState.h @@ -1653,6 +1653,9 @@ public: const vector &get_acting() const { return acting; } + const set &get_actingset() const { + return actingset; + } int get_acting_primary() const { return primary.osd; } @@ -1678,6 +1681,9 @@ public: const set &get_async_recovery_targets() const { return async_recovery_targets; } + const set &get_acting_recovery_backfill() const { + return acting_recovery_backfill; + } bool state_test(uint64_t m) const { return (state & m) != 0; } void state_set(uint64_t m) { state |= m; } diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index dc866d8d0ac..cde245b1337 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -637,9 +637,9 @@ bool PrimaryLogPG::is_degraded_or_backfilling_object(const hobject_t& soid) return true; if (pg_log.get_missing().get_items().count(soid)) return true; - ceph_assert(!acting_recovery_backfill.empty()); - for (set::iterator i = acting_recovery_backfill.begin(); - i != acting_recovery_backfill.end(); + ceph_assert(!get_acting_recovery_backfill().empty()); + for (set::iterator i = get_acting_recovery_backfill().begin(); + i != get_acting_recovery_backfill().end(); ++i) { if (*i == get_primary()) continue; pg_shard_t peer = *i; @@ -776,9 +776,9 @@ void PrimaryLogPG::maybe_force_recovery() min_version = pg_log.get_missing().get_rmissing().begin()->first; soid = pg_log.get_missing().get_rmissing().begin()->second; } - ceph_assert(!acting_recovery_backfill.empty()); - for (set::iterator it = acting_recovery_backfill.begin(); - it != acting_recovery_backfill.end(); + ceph_assert(!get_acting_recovery_backfill().empty()); + for (set::iterator it = get_acting_recovery_backfill().begin(); + it != get_acting_recovery_backfill().end(); ++it) { if (*it == get_primary()) continue; pg_shard_t peer = *it; @@ -10451,8 +10451,8 @@ void PrimaryLogPG::issue_repop(RepGather *repop, OpContext *ctx) repop->v = ctx->at_version; if (ctx->at_version > eversion_t()) { - for (set::iterator i = acting_recovery_backfill.begin(); - i != acting_recovery_backfill.end(); + for (set::iterator i = get_acting_recovery_backfill().begin(); + i != get_acting_recovery_backfill().end(); ++i) { if (*i == get_primary()) continue; pg_info_t &pinfo = peer_info[*i]; @@ -10499,7 +10499,7 @@ void PrimaryLogPG::issue_repop(RepGather *repop, OpContext *ctx) eversion_t(), entry.is_delete()); // clear out missing_loc missing_loc.clear_location(entry.soid); - for (auto &i: actingset) { + for (auto &i: get_actingset()) { if (!peer_missing[i].is_missing(entry.soid)) missing_loc.add_location(entry.soid, i); } @@ -10652,8 +10652,8 @@ void PrimaryLogPG::submit_log_entries( set waiting_on; - for (set::const_iterator i = acting_recovery_backfill.begin(); - i != acting_recovery_backfill.end(); + for (set::const_iterator i = get_acting_recovery_backfill().begin(); + i != get_acting_recovery_backfill().end(); ++i) { pg_shard_t peer(*i); if (peer == pg_whoami) continue; @@ -11414,7 +11414,7 @@ int PrimaryLogPG::recover_missing( lock(); if (!pg_has_reset_since(cur_epoch)) { bool object_missing = false; - for (const auto& shard : acting_recovery_backfill) { + for (const auto& shard : get_acting_recovery_backfill()) { if (shard == pg_whoami) continue; if (peer_missing[shard].is_missing(soid)) { @@ -11645,9 +11645,9 @@ eversion_t PrimaryLogPG::pick_newest_available(const hobject_t& oid) v = pmi.have; dout(10) << "pick_newest_available " << oid << " " << v << " on osd." << osd->whoami << " (local)" << dendl; - ceph_assert(!acting_recovery_backfill.empty()); - for (set::iterator i = acting_recovery_backfill.begin(); - i != acting_recovery_backfill.end(); + ceph_assert(!get_acting_recovery_backfill().empty()); + for (set::iterator i = get_acting_recovery_backfill().begin(); + i != get_acting_recovery_backfill().end(); ++i) { if (*i == get_primary()) continue; pg_shard_t peer = *i; @@ -12645,9 +12645,9 @@ bool PrimaryLogPG::primary_error( pg_log.set_last_requested(0); missing_loc.remove_location(soid, pg_whoami); bool uhoh = true; - ceph_assert(!acting_recovery_backfill.empty()); - for (set::iterator i = acting_recovery_backfill.begin(); - i != acting_recovery_backfill.end(); + ceph_assert(!get_acting_recovery_backfill().empty()); + for (set::iterator i = get_acting_recovery_backfill().begin(); + i != get_acting_recovery_backfill().end(); ++i) { if (*i == get_primary()) continue; pg_shard_t peer = *i; @@ -12756,13 +12756,13 @@ uint64_t PrimaryLogPG::recover_replicas(uint64_t max, ThreadPool::TPHandle &hand PGBackend::RecoveryHandle *h = pgbackend->open_recovery_op(); // this is FAR from an optimal recovery order. pretty lame, really. - ceph_assert(!acting_recovery_backfill.empty()); + ceph_assert(!get_acting_recovery_backfill().empty()); // choose replicas to recover, replica has the shortest missing list first // so we can bring it back to normal ASAP std::vector> replicas_by_num_missing, async_by_num_missing; - replicas_by_num_missing.reserve(acting_recovery_backfill.size() - 1); - for (auto &p: acting_recovery_backfill) { + replicas_by_num_missing.reserve(get_acting_recovery_backfill().size() - 1); + for (auto &p: get_acting_recovery_backfill()) { if (p == get_primary()) { continue; } @@ -15106,7 +15106,7 @@ int PrimaryLogPG::rep_repair_primary_object(const hobject_t& soid, OpContext *ct ceph_assert(is_primary()); dout(10) << __func__ << " " << soid - << " peers osd.{" << acting_recovery_backfill << "}" << dendl; + << " peers osd.{" << get_acting_recovery_backfill() << "}" << dendl; if (!is_clean()) { block_for_clean(soid, op); diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index 167c7e2d4af..96fa050e525 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -333,10 +333,10 @@ public: return get_last_peering_reset(); } const set &get_acting_recovery_backfill_shards() const override { - return acting_recovery_backfill; + return get_acting_recovery_backfill(); } const set &get_acting_shards() const override { - return actingset; + return recovery_state.get_actingset(); } const set &get_backfill_shards() const override { return get_backfill_targets(); @@ -1826,7 +1826,7 @@ public: bool is_missing_object(const hobject_t& oid) const; bool is_unreadable_object(const hobject_t &oid) const { return is_missing_object(oid) || - !missing_loc.readable_with_acting(oid, actingset); + !missing_loc.readable_with_acting(oid, get_actingset()); } void maybe_kick_recovery(const hobject_t &soid); void wait_for_unreadable_object(const hobject_t& oid, OpRequestRef op);