diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/osd/PG.cc | 90 | ||||
-rw-r--r-- | src/osd/PG.h | 16 | ||||
-rw-r--r-- | src/osd/PeeringState.cc | 91 | ||||
-rw-r--r-- | src/osd/PeeringState.h | 16 | ||||
-rw-r--r-- | src/osd/PrimaryLogPG.cc | 6 |
5 files changed, 111 insertions, 108 deletions
diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 48fea1c5285..6db4b3d5aec 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -3475,96 +3475,6 @@ void PG::scrub_finish() } } -bool PG::append_log_entries_update_missing( - const mempool::osd_pglog::list<pg_log_entry_t> &entries, - ObjectStore::Transaction &t, boost::optional<eversion_t> trim_to, - boost::optional<eversion_t> roll_forward_to) -{ - ceph_assert(!entries.empty()); - ceph_assert(entries.begin()->version > info.last_update); - - PGLogEntryHandler rollbacker{this, &t}; - bool invalidate_stats = - pg_log.append_new_log_entries(info.last_backfill, - info.last_backfill_bitwise, - entries, - &rollbacker); - - if (roll_forward_to && entries.rbegin()->soid > info.last_backfill) { - pg_log.roll_forward(&rollbacker); - } - if (roll_forward_to && *roll_forward_to > pg_log.get_can_rollback_to()) { - pg_log.roll_forward_to(*roll_forward_to, &rollbacker); - last_rollback_info_trimmed_to_applied = *roll_forward_to; - } - - info.last_update = pg_log.get_head(); - - if (pg_log.get_missing().num_missing() == 0) { - // advance last_complete since nothing else is missing! - info.last_complete = info.last_update; - } - info.stats.stats_invalid = info.stats.stats_invalid || invalidate_stats; - - dout(20) << __func__ << " trim_to bool = " << bool(trim_to) << " trim_to = " << (trim_to ? *trim_to : eversion_t()) << dendl; - if (trim_to) - pg_log.trim(*trim_to, info); - dirty_info = true; - write_if_dirty(t); - return invalidate_stats; -} - - -void PG::merge_new_log_entries( - const mempool::osd_pglog::list<pg_log_entry_t> &entries, - ObjectStore::Transaction &t, - boost::optional<eversion_t> trim_to, - boost::optional<eversion_t> roll_forward_to) -{ - dout(10) << __func__ << " " << entries << dendl; - ceph_assert(is_primary()); - - bool rebuild_missing = append_log_entries_update_missing(entries, t, trim_to, roll_forward_to); - for (set<pg_shard_t>::const_iterator i = acting_recovery_backfill.begin(); - i != acting_recovery_backfill.end(); - ++i) { - pg_shard_t peer(*i); - if (peer == pg_whoami) continue; - ceph_assert(peer_missing.count(peer)); - ceph_assert(peer_info.count(peer)); - pg_missing_t& pmissing(peer_missing[peer]); - dout(20) << __func__ << " peer_missing for " << peer << " = " << pmissing << dendl; - pg_info_t& pinfo(peer_info[peer]); - bool invalidate_stats = PGLog::append_log_entries_update_missing( - pinfo.last_backfill, - info.last_backfill_bitwise, - entries, - true, - NULL, - pmissing, - NULL, - this); - pinfo.last_update = info.last_update; - pinfo.stats.stats_invalid = pinfo.stats.stats_invalid || invalidate_stats; - rebuild_missing = rebuild_missing || invalidate_stats; - } - - if (!rebuild_missing) { - return; - } - - for (auto &&i: entries) { - missing_loc.rebuild( - i.soid, - pg_whoami, - acting_recovery_backfill, - info, - pg_log.get_missing(), - peer_missing, - peer_info); - } -} - bool PG::old_peering_msg(epoch_t reply_epoch, epoch_t query_epoch) { if (last_peering_reset > reply_epoch || diff --git a/src/osd/PG.h b/src/osd/PG.h index e0023afb30f..461078c874e 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -1506,22 +1506,6 @@ protected: bool queue_scrub(); unsigned get_scrub_priority(); - bool append_log_entries_update_missing( - const mempool::osd_pglog::list<pg_log_entry_t> &entries, - ObjectStore::Transaction &t, - boost::optional<eversion_t> trim_to, - boost::optional<eversion_t> roll_forward_to); - - /** - * Merge entries updating missing as necessary on all - * acting_recovery_backfill logs and missings (also missing_loc) - */ - void merge_new_log_entries( - const mempool::osd_pglog::list<pg_log_entry_t> &entries, - ObjectStore::Transaction &t, - boost::optional<eversion_t> trim_to, - boost::optional<eversion_t> roll_forward_to); - bool try_flush_or_schedule_async() override; void start_flush_on_transaction( ObjectStore::Transaction *t) override; diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index fb4f7090617..8b09dbe7e94 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -3407,6 +3407,97 @@ void PeeringState::update_stats( } } +bool PeeringState::append_log_entries_update_missing( + const mempool::osd_pglog::list<pg_log_entry_t> &entries, + ObjectStore::Transaction &t, boost::optional<eversion_t> trim_to, + boost::optional<eversion_t> roll_forward_to) +{ + ceph_assert(!entries.empty()); + ceph_assert(entries.begin()->version > info.last_update); + + PGLog::LogEntryHandlerRef rollbacker{pl->get_log_handler(&t)}; + bool invalidate_stats = + pg_log.append_new_log_entries( + info.last_backfill, + info.last_backfill_bitwise, + entries, + rollbacker.get()); + + if (roll_forward_to && entries.rbegin()->soid > info.last_backfill) { + pg_log.roll_forward(rollbacker.get()); + } + if (roll_forward_to && *roll_forward_to > pg_log.get_can_rollback_to()) { + pg_log.roll_forward_to(*roll_forward_to, rollbacker.get()); + last_rollback_info_trimmed_to_applied = *roll_forward_to; + } + + info.last_update = pg_log.get_head(); + + if (pg_log.get_missing().num_missing() == 0) { + // advance last_complete since nothing else is missing! + info.last_complete = info.last_update; + } + info.stats.stats_invalid = info.stats.stats_invalid || invalidate_stats; + + psdout(20) << __func__ << " trim_to bool = " << bool(trim_to) + << " trim_to = " << (trim_to ? *trim_to : eversion_t()) << dendl; + if (trim_to) + pg_log.trim(*trim_to, info); + dirty_info = true; + write_if_dirty(t); + return invalidate_stats; +} + +void PeeringState::merge_new_log_entries( + const mempool::osd_pglog::list<pg_log_entry_t> &entries, + ObjectStore::Transaction &t, + boost::optional<eversion_t> trim_to, + boost::optional<eversion_t> roll_forward_to) +{ + psdout(10) << __func__ << " " << entries << dendl; + ceph_assert(is_primary()); + + bool rebuild_missing = append_log_entries_update_missing(entries, t, trim_to, roll_forward_to); + for (set<pg_shard_t>::const_iterator i = acting_recovery_backfill.begin(); + i != acting_recovery_backfill.end(); + ++i) { + pg_shard_t peer(*i); + if (peer == pg_whoami) continue; + ceph_assert(peer_missing.count(peer)); + ceph_assert(peer_info.count(peer)); + pg_missing_t& pmissing(peer_missing[peer]); + psdout(20) << __func__ << " peer_missing for " << peer + << " = " << pmissing << dendl; + pg_info_t& pinfo(peer_info[peer]); + bool invalidate_stats = PGLog::append_log_entries_update_missing( + pinfo.last_backfill, + info.last_backfill_bitwise, + entries, + true, + NULL, + pmissing, + NULL, + dpp); + pinfo.last_update = info.last_update; + pinfo.stats.stats_invalid = pinfo.stats.stats_invalid || invalidate_stats; + rebuild_missing = rebuild_missing || invalidate_stats; + } + + if (!rebuild_missing) { + return; + } + + for (auto &&i: entries) { + missing_loc.rebuild( + i.soid, + pg_whoami, + acting_recovery_backfill, + info, + pg_log.get_missing(), + peer_missing, + peer_info); + } +} /*------------ Peering State Machine----------------*/ #undef dout_prefix #define dout_prefix (context< PeeringMachine >().dpp->gen_prefix(*_dout) \ diff --git a/src/osd/PeeringState.h b/src/osd/PeeringState.h index 4f6e5c09893..93bb82f53ba 100644 --- a/src/osd/PeeringState.h +++ b/src/osd/PeeringState.h @@ -1412,6 +1412,22 @@ public: void update_blocked_by(); void update_calc_stats(); + + bool append_log_entries_update_missing( + const mempool::osd_pglog::list<pg_log_entry_t> &entries, + ObjectStore::Transaction &t, + boost::optional<eversion_t> trim_to, + boost::optional<eversion_t> roll_forward_to); + + /** + * Merge entries updating missing as necessary on all + * acting_recovery_backfill logs and missings (also missing_loc) + */ + void merge_new_log_entries( + const mempool::osd_pglog::list<pg_log_entry_t> &entries, + ObjectStore::Transaction &t, + boost::optional<eversion_t> trim_to, + boost::optional<eversion_t> roll_forward_to); public: PeeringState( CephContext *cct, diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 23c03e1af20..bc56693556d 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -10668,7 +10668,8 @@ void PrimaryLogPG::submit_log_entries( [this, entries, repop, on_complete]() { ObjectStore::Transaction t; eversion_t old_last_update = info.last_update; - merge_new_log_entries(entries, t, pg_trim_to, min_last_complete_ondisk); + recovery_state.merge_new_log_entries( + entries, t, pg_trim_to, min_last_complete_ondisk); set<pg_shard_t> waiting_on; @@ -11715,7 +11716,8 @@ void PrimaryLogPG::do_update_log_missing(OpRequestRef &op) dout(20) << __func__ << " op_trim_to = " << op_trim_to << " op_roll_forward_to = " << op_roll_forward_to << dendl; - append_log_entries_update_missing(m->entries, t, op_trim_to, op_roll_forward_to); + recovery_state.append_log_entries_update_missing( + m->entries, t, op_trim_to, op_roll_forward_to); eversion_t new_lcod = info.last_complete; Context *complete = new FunctionContext( |