bool need_write_epoch,
ceph::os::Transaction &t) final;
- /// Need to reschedule next scrub. Assuming no change in role
- void reschedule_scrub() final {
- }
-
void scrub_requested(scrub_level_t scrub_level, scrub_type_t scrub_type) final;
uint64_t get_snap_trimq_size() const final {
if (!pg)
continue;
- if (!pg->get_planned_scrub().must_scrub && !pg->get_planned_scrub().need_auto) {
- dout(15) << __func__ << ": reschedule " << job.pgid << dendl;
- pg->reschedule_scrub();
- }
+ dout(15) << __func__ << ": updating scrub schedule on " << job.pgid << dendl;
+ pg->on_scrub_schedule_input_change();
+
pg->unlock();
}
dout(10) << __func__ << ": done" << dendl;
return upd_flags;
}
-void PG::reschedule_scrub()
+void PG::on_scrub_schedule_input_change()
{
- dout(20) << fmt::format(
- "{} for a {}", __func__,
- (is_primary() ? "Primary" : "non-primary"))
- << dendl;
-
- // we are assuming no change in primary status
- if (is_primary()) {
+ if (is_active() && is_primary()) {
+ dout(20) << __func__ << ": active/primary" << dendl;
ceph_assert(m_scrubber);
m_scrubber->update_scrub_job(m_planned_scrub);
+ } else {
+ dout(20) << __func__ << ": inactive or non-primary" << dendl;
}
}
recovery_state.activate_map(rctx);
requeue_map_waiters();
+
+ // pool options affecting scrub may have changed
+ on_scrub_schedule_input_change();
}
void PG::handle_initialize(PeeringCtx &rctx)
set_last_scrub_stamp(t, history, stats);
return true;
});
+ on_scrub_schedule_input_change();
}
static void set_last_deep_scrub_stamp(
set_last_deep_scrub_stamp(t, history, stats);
return true;
});
+ on_scrub_schedule_input_change();
}
static void add_objects_scrubbed_count(
void on_pool_change() override;
virtual void plpg_on_pool_change() = 0;
- void reschedule_scrub() override;
+ /**
+ * on_scrub_schedule_input_change
+ *
+ * To be called when inputs to scrub scheduling may have changed.
+ * - OSD config params related to scrub such as osd_scrub_min_interval,
+ * osd_scrub_max_interval
+ * - Pool params related to scrub such as osd_scrub_min_interval,
+ * osd_scrub_max_interval
+ * - pg stat scrub timestamps
+ * - etc
+ */
+ void on_scrub_schedule_input_change();
void scrub_requested(scrub_level_t scrub_level, scrub_type_t scrub_type) override;
}
}
- if (is_primary() && was_old_primary) {
- pl->reschedule_scrub();
- }
-
if (acting.empty() && !up.empty() && up_primary == pg_whoami) {
psdout(10) << " acting empty, but i am up[0], clearing pg_temp" << dendl;
pl->queue_want_pg_temp(acting);
if (f(info.history, info.stats)) {
pl->publish_stats_to_osd();
}
- pl->reschedule_scrub();
if (t) {
dirty_info = true;
bool need_write_epoch,
ObjectStore::Transaction &t) = 0;
- /// Need to reschedule next scrub. Assuming no change in role
- virtual void reschedule_scrub() = 0;
-
/// Notify that a scrub has been requested
virtual void scrub_requested(scrub_level_t scrub_level, scrub_type_t scrub_type) = 0;
int tr = m_osds->store->queue_transaction(m_pg->ch, std::move(t), nullptr);
ceph_assert(tr == 0);
}
+ update_scrub_job(m_planned_scrub);
if (has_error) {
m_pg->queue_peering_event(PGPeeringEventRef(