From 4a0f770d6e4a462e130cf52f606609937ed8bf06 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Tue, 9 Apr 2019 21:57:56 -0700 Subject: [PATCH] PeeringState: mark state and helpers private Signed-off-by: Samuel Just --- src/osd/PG.cc | 7 +++---- src/osd/PG.h | 13 ++++++------- src/osd/PeeringState.cc | 2 ++ src/osd/PeeringState.h | 41 ++++++++++++++++++++++------------------- 4 files changed, 33 insertions(+), 30 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 95997e46fb4..777247ccbc6 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -178,16 +178,17 @@ void PG::dump_live_ids() PG::PG(OSDService *o, OSDMapRef curmap, const PGPool &_pool, spg_t p) : + pg_whoami(osd->whoami, p.shard), + pg_id(p), recovery_state( cct, + pg_whoami, p, _pool, curmap, this, this), - pg_whoami(recovery_state.pg_whoami), info(recovery_state.get_info()), - pg_id(p), coll(p), osd(o), cct(o->cct), @@ -1193,8 +1194,6 @@ void PG::read_state(ObjectStore *store) ceph_abort_msg("PG too old to upgrade"); } - recovery_state.last_written_info = info; - recovery_state.init_from_disk_state( std::move(info_from_disk), std::move(past_intervals_from_disk), diff --git a/src/osd/PG.h b/src/osd/PG.h index 8995ca38fd1..6cc90a2fe06 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -172,22 +172,21 @@ class PG : public DoutPrefixProvider, public PeeringState::PeeringListener { friend class NamedState; friend class PeeringState; -protected: - PeeringState recovery_state; public: - using PeeringCtx = PeeringState::PeeringCtx; + const pg_shard_t pg_whoami; + const spg_t pg_id; + PeeringState recovery_state; + using PeeringCtx = PeeringState::PeeringCtx; protected: /** - * Peering state information being moved to PeeringState + * Ref to pg_info_t in Peering state */ - pg_shard_t pg_whoami; const pg_info_t &info; public: // -- members -- - const spg_t pg_id; const coll_t coll; ObjectStore::CollectionHandle ch; @@ -322,7 +321,7 @@ public: return recovery_state.get_up_primary(); } const PastIntervals& get_past_intervals() const { - return recovery_state.past_intervals; + return recovery_state.get_past_intervals(); } bool is_acting_recovery_backfill(pg_shard_t osd) const { return recovery_state.is_acting_recovery_backfill(osd); diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index 27f91bfce2f..53a3a97f3fb 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -113,6 +113,7 @@ void PeeringState::PeeringMachine::send_query( PeeringState::PeeringState( CephContext *cct, + pg_shard_t pg_whoami, spg_t spgid, const PGPool &_pool, OSDMapRef curmap, @@ -126,6 +127,7 @@ PeeringState::PeeringState( orig_ctx(0), osdmap_ref(curmap), pool(_pool), + pg_whoami(pg_whoami), info(spgid), pg_log(cct), missing_loc(spgid, this, dpp, cct) diff --git a/src/osd/PeeringState.h b/src/osd/PeeringState.h index 01ecaf17b7a..0ba13b960f0 100644 --- a/src/osd/PeeringState.h +++ b/src/osd/PeeringState.h @@ -1157,7 +1157,6 @@ public: */ boost::optional rctx; -public: /** * OSDMap state */ @@ -1262,14 +1261,10 @@ public: osdmap_ref = std::move(newmap); } - void write_if_dirty(ObjectStore::Transaction& t); - void update_heartbeat_peers(); bool proc_replica_info( pg_shard_t from, const pg_info_t &oinfo, epoch_t send_epoch); void remove_down_peer_info(const OSDMapRef &osdmap); - void purge_strays(); - void update_history(const pg_history_t& new_history); void check_recovery_sources(const OSDMapRef& map); void set_last_peering_reset(); void check_full_transition(OSDMapRef lastmap, OSDMapRef osdmap); @@ -1286,11 +1281,6 @@ public: const vector& newacting, int acting_primary, ObjectStore::Transaction *t); void on_new_interval(); - void init_primary_up_acting( - const vector &newup, - const vector &newacting, - int new_up_primary, - int new_acting_primary); void clear_recovery_state(); void clear_primary_state(); void check_past_interval_bounds() const; @@ -1363,7 +1353,6 @@ public: const pg_info_t &oinfo, const pg_missing_t &omissing, pg_shard_t fromosd, PeeringCtx*); - void discover_all_missing(std::map > &query_map); void build_might_have_unfound(); void log_weirdness(); void activate( @@ -1372,7 +1361,6 @@ public: map >& query_map, map > > *activator_map, PeeringCtx *ctx); - void share_pg_info(); void rewind_divergent_log(ObjectStore::Transaction& t, eversion_t newhead); void merge_log( @@ -1417,12 +1405,6 @@ public: void update_blocked_by(); void update_calc_stats(); - bool append_log_entries_update_missing( - const mempool::osd_pglog::list &entries, - ObjectStore::Transaction &t, - boost::optional trim_to, - boost::optional roll_forward_to); - void add_log_entry(const pg_log_entry_t& e, bool applied); void calc_trim_to(); @@ -1431,6 +1413,7 @@ public: public: PeeringState( CephContext *cct, + pg_shard_t pg_whoami, spg_t spgid, const PGPool &pool, OSDMapRef curmap, @@ -1491,6 +1474,13 @@ public: log_weirdness(); } + void init_primary_up_acting( + const vector &newup, + const vector &newacting, + int new_up_primary, + int new_acting_primary); + + void share_pg_info(); void start_split_stats( const set& childpgs, vector *out); @@ -1504,11 +1494,14 @@ public: unsigned split_bits, const pg_merge_meta_t& last_pg_merge_meta); + void purge_strays(); + void update_stats( std::function f, ObjectStore::Transaction *t = nullptr); void update_hset(const pg_hit_set_history_t &hset_history); + void update_history(const pg_history_t& new_history); std::optional prepare_stats_for_publish( bool pg_stats_publish_valid, @@ -1519,7 +1512,7 @@ public: * Merge entries updating missing as necessary on all * acting_recovery_backfill logs and missings (also missing_loc) */ - void merge_new_log_entries( + bool append_log_entries_update_missing( const mempool::osd_pglog::list &entries, ObjectStore::Transaction &t, boost::optional trim_to, @@ -1533,6 +1526,12 @@ public: bool transaction_applied, bool async); + void merge_new_log_entries( + const mempool::osd_pglog::list &entries, + ObjectStore::Transaction &t, + boost::optional trim_to, + boost::optional roll_forward_to); + void add_local_next_event(const pg_log_entry_t& e) { pg_log.missing_add_next_entry(e); } @@ -1564,6 +1563,8 @@ public: pg_shard_t peer, const hobject_t soid); + void discover_all_missing(std::map > &query_map); + void object_recovered( const hobject_t &hoid, const object_stat_sum_t &stat_diff) { @@ -1630,6 +1631,8 @@ public: pg_log.set_last_requested(v); } + void write_if_dirty(ObjectStore::Transaction& t); + void complete_write(eversion_t v, eversion_t lc); void local_write_applied(eversion_t v) { last_update_applied = v; -- 2.39.5