return false;
}
-
-void PG::check_past_interval_bounds() const
-{
- auto rpib = get_required_past_interval_bounds(
- info,
- osd->get_superblock().oldest_map);
- if (rpib.first >= rpib.second) {
- if (!past_intervals.empty()) {
- osd->clog->error() << info.pgid << " required past_interval bounds are"
- << " empty [" << rpib << ") but past_intervals is not: "
- << past_intervals;
- derr << info.pgid << " required past_interval bounds are"
- << " empty [" << rpib << ") but past_intervals is not: "
- << past_intervals << dendl;
- }
- } else {
- if (past_intervals.empty()) {
- osd->clog->error() << info.pgid << " required past_interval bounds are"
- << " not empty [" << rpib << ") but past_intervals "
- << past_intervals << " is empty";
- derr << info.pgid << " required past_interval bounds are"
- << " not empty [" << rpib << ") but past_intervals "
- << past_intervals << " is empty" << dendl;
- ceph_assert(!past_intervals.empty());
- }
-
- auto apib = past_intervals.get_bounds();
- if (apib.first > rpib.first) {
- osd->clog->error() << info.pgid << " past_intervals [" << apib
- << ") start interval does not contain the required"
- << " bound [" << rpib << ") start";
- derr << info.pgid << " past_intervals [" << apib
- << ") start interval does not contain the required"
- << " bound [" << rpib << ") start" << dendl;
- ceph_abort_msg("past_interval start interval mismatch");
- }
- if (apib.second != rpib.second) {
- osd->clog->error() << info.pgid << " past_interal bound [" << apib
- << ") end does not match required [" << rpib
- << ") end";
- derr << info.pgid << " past_interal bound [" << apib
- << ") end does not match required [" << rpib
- << ") end" << dendl;
- ceph_abort_msg("past_interval end mismatch");
- }
- }
-}
-
bool PG::adjust_need_up_thru(const OSDMapRef osdmap)
{
epoch_t up_thru = osdmap->get_up_thru(osd->whoami);
dout(10) << __func__ << dendl;
- check_past_interval_bounds();
+ recovery_state.check_past_interval_bounds();
might_have_unfound = past_intervals.get_might_have_unfound(
pg_whoami,
return osd->get_superblock().oldest_map;
}
+LogChannel &PG::get_clog() {
+ return *(osd->clog);
+}
+
void PG::do_replica_scrub_map(OpRequestRef op)
{
const MOSDRepScrubMap *m = static_cast<const MOSDRepScrubMap*>(op->get_req());
void clear_primary_state() override;
epoch_t oldest_stored_osdmap() override;
+ LogChannel &get_clog() override;
bool is_forced_recovery_or_backfill() const {
return get_state() & (PG_STATE_FORCED_RECOVERY | PG_STATE_FORCED_BACKFILL);
void try_mark_clean(); ///< mark an active pg clean
- /// return [start,end) bounds for required past_intervals
- static pair<epoch_t, epoch_t> get_required_past_interval_bounds(
- const pg_info_t &info,
- epoch_t oldest_map) {
- epoch_t start = std::max(
- info.history.last_epoch_clean ? info.history.last_epoch_clean :
- info.history.epoch_pool_created,
- oldest_map);
- epoch_t end = std::max(
- info.history.same_interval_since,
- info.history.epoch_pool_created);
- return make_pair(start, end);
- }
- void check_past_interval_bounds() const;
PastIntervals::PriorSet build_prior();
bool adjust_need_up_thru(const OSDMapRef osdmap);
pl->clear_primary_state();
}
+/// return [start,end) bounds for required past_intervals
+static pair<epoch_t, epoch_t> get_required_past_interval_bounds(
+ const pg_info_t &info,
+ epoch_t oldest_map) {
+ epoch_t start = std::max(
+ info.history.last_epoch_clean ? info.history.last_epoch_clean :
+ info.history.epoch_pool_created,
+ oldest_map);
+ epoch_t end = std::max(
+ info.history.same_interval_since,
+ info.history.epoch_pool_created);
+ return make_pair(start, end);
+}
+
+
+void PeeringState::check_past_interval_bounds() const
+{
+ auto rpib = get_required_past_interval_bounds(
+ info,
+ pl->oldest_stored_osdmap());
+ if (rpib.first >= rpib.second) {
+ if (!past_intervals.empty()) {
+ pl->get_clog().error() << info.pgid << " required past_interval bounds are"
+ << " empty [" << rpib << ") but past_intervals is not: "
+ << past_intervals;
+ derr << info.pgid << " required past_interval bounds are"
+ << " empty [" << rpib << ") but past_intervals is not: "
+ << past_intervals << dendl;
+ }
+ } else {
+ if (past_intervals.empty()) {
+ pl->get_clog().error() << info.pgid << " required past_interval bounds are"
+ << " not empty [" << rpib << ") but past_intervals "
+ << past_intervals << " is empty";
+ derr << info.pgid << " required past_interval bounds are"
+ << " not empty [" << rpib << ") but past_intervals "
+ << past_intervals << " is empty" << dendl;
+ ceph_assert(!past_intervals.empty());
+ }
+
+ auto apib = past_intervals.get_bounds();
+ if (apib.first > rpib.first) {
+ pl->get_clog().error() << info.pgid << " past_intervals [" << apib
+ << ") start interval does not contain the required"
+ << " bound [" << rpib << ") start";
+ derr << info.pgid << " past_intervals [" << apib
+ << ") start interval does not contain the required"
+ << " bound [" << rpib << ") start" << dendl;
+ ceph_abort_msg("past_interval start interval mismatch");
+ }
+ if (apib.second != rpib.second) {
+ pl->get_clog().error() << info.pgid << " past_interal bound [" << apib
+ << ") end does not match required [" << rpib
+ << ") end";
+ derr << info.pgid << " past_interal bound [" << apib
+ << ") end does not match required [" << rpib
+ << ") end" << dendl;
+ ceph_abort_msg("past_interval end mismatch");
+ }
+ }
+}
/*------------ Peering State Machine----------------*/
#undef dout_prefix
boost::statechart::result PeeringState::Reset::react(const AdvMap& advmap)
{
PeeringState *ps = context< PeeringMachine >().state;
- PG *pg = context< PeeringMachine >().pg;
psdout(10) << "Reset advmap" << dendl;
ps->check_full_transition(advmap.lastmap, advmap.osdmap);
context< PeeringMachine >().get_cur_transaction());
}
ps->remove_down_peer_info(advmap.osdmap);
- pg->check_past_interval_bounds();
+ ps->check_past_interval_bounds();
return discard_event();
}
{
context< PeeringMachine >().log_enter(state_name);
+ PeeringState *ps = context< PeeringMachine >().state;
PG *pg = context< PeeringMachine >().pg;
- pg->check_past_interval_bounds();
+ ps->check_past_interval_bounds();
PastIntervals::PriorSet &prior_set = context< Peering >().prior_set;
ceph_assert(pg->blocked_by.empty());
#include "os/ObjectStore.h"
#include "OSDMap.h"
#include "MissingLoc.h"
+#include "common/LogClient.h"
class PG;
virtual void on_new_interval() = 0;
virtual epoch_t oldest_stored_osdmap() = 0;
+ virtual LogChannel &get_clog() = 0;
virtual ~PeeringListener() {}
};
int new_up_primary,
int new_acting_primary);
void clear_primary_state();
+ void check_past_interval_bounds() const;
public:
PeeringState(