must);
dout(10) << __func__ << " pg " << pg_id << " register next scrub, scrub time "
<< scrubber.scrub_reg_stamp << ", must = " << (int)must << dendl;
+ scrub_registered = true;
}
void PG::unreg_next_scrub()
{
- if (is_primary()) {
+ if (scrub_registered) {
osd->unreg_pg_scrub(info.pgid, scrubber.scrub_reg_stamp);
scrubber.scrub_reg_stamp = utime_t();
+ scrub_registered = false;
}
}
+void PG::on_info_history_change()
+{
+ unreg_next_scrub();
+ reg_next_scrub();
+}
+
+void PG::scrub_requested(bool deep, bool repair)
+{
+ unreg_next_scrub();
+ scrubber.must_scrub = true;
+ scrubber.must_deep_scrub = deep || repair;
+ scrubber.must_repair = repair;
+ reg_next_scrub();
+}
+
void PG::clear_ready_to_merge() {
osd->clear_ready_to_merge(this);
}
void scrub(epoch_t queued, ThreadPool::TPHandle &handle);
- void reg_next_scrub() override;
- void unreg_next_scrub() override;
+ void reg_next_scrub();
+ void unreg_next_scrub();
void clear_ready_to_merge() override;
void on_pool_change() override;
virtual void plpg_on_pool_change() = 0;
+ void on_info_history_change() override;
+
+ void scrub_requested(bool deep, bool repair) override;
void clear_publish_stats() override;
void clear_primary_state() override;
/* You should not use these items without taking their respective queue locks
* (if they have one) */
xlist<PG*>::item stat_queue_item;
+ bool scrub_registered = false;
bool scrub_queued;
bool recovery_queued;
void PeeringState::update_history(const pg_history_t& new_history)
{
- pl->unreg_next_scrub();
if (info.history.merge(new_history)) {
psdout(20) << __func__ << " advanced history from " << new_history << dendl;
dirty_info = true;
dirty_big_info = true;
}
}
- pl->reg_next_scrub();
+ pl->on_info_history_change();
}
void PeeringState::purge_strays()
vector<int> oldacting, oldup;
int oldrole = get_role();
- pl->unreg_next_scrub();
if (is_primary()) {
pl->clear_ready_to_merge();
}
}
pl->on_new_interval();
- pl->reg_next_scrub();
+ pl->on_info_history_change();
psdout(1) << __func__ << " up " << oldup << " -> " << up
<< ", acting " << oldacting << " -> " << acting
boost::statechart::result PeeringState::Primary::react(
const RequestScrub& evt)
{
- PG *pg = context< PeeringMachine >().pg;
- if (pg->is_primary()) {
- pg->unreg_next_scrub();
- pg->scrubber.must_scrub = true;
- pg->scrubber.must_deep_scrub = evt.deep || evt.repair;
- pg->scrubber.must_repair = evt.repair;
- pg->reg_next_scrub();
- ldout(pg->cct,10) << "marking for scrub" << dendl;
+ PeeringListener *pl = context< PeeringMachine >().pl;
+ PeeringState *ps = context< PeeringMachine >().state;
+ if (ps->is_primary()) {
+ pl->scrub_requested(evt.deep, evt.repair);
+ psdout(10) << "marking for scrub" << dendl;
}
return discard_event();
}
ObjectStore::Transaction* t = context<PeeringMachine>().get_cur_transaction();
if (msg->info.last_backfill == hobject_t()) {
// restart backfill
- pg->unreg_next_scrub();
pg->info = msg->info;
- pg->reg_next_scrub();
+ pg->on_info_history_change();
pg->dirty_info = true;
pg->dirty_big_info = true; // maybe.
ObjectStore::Transaction &t) = 0;
virtual void update_heartbeat_peers(set<int> peers) = 0;
- virtual void reg_next_scrub() = 0;
- virtual void unreg_next_scrub() = 0;
+ virtual void on_info_history_change() = 0;
+ virtual void scrub_requested(bool deep, bool repair) = 0;
virtual void send_cluster_message(int osd, Message *m, epoch_t epoch) = 0;