Skip to content

Commit 77d7c3b

Browse files
committed
osd/scrub: remove the 'deadline' attribute from the scrub job
The scrub job's 'overdue' attribute is no longer calculated - the only 'scrub is overdue' status remaining after latest scheduling refactor, is the one performed in PGMap.cc (the one affecting the 'health warning' status of the cluster). Thus - there is no longer any reason to maintain any 'deadline' attribute for the scrub scheduler. Signed-off-by: Ronen Friedman <[email protected]> (cherry picked from commit 5f83bde)
1 parent 12fbcab commit 77d7c3b

File tree

6 files changed

+19
-97
lines changed

6 files changed

+19
-97
lines changed

src/osd/scrubber/osd_scrub_sched.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ void ScrubQueue::dump_scrubs(ceph::Formatter* f) const
157157
f->dump_stream("pgid") << e.pgid;
158158
f->dump_stream("sched_time") << e.schedule.not_before;
159159
f->dump_stream("orig_sched_time") << e.schedule.scheduled_at;
160-
f->dump_stream("deadline") << e.schedule.deadline;
161160
f->dump_bool(
162161
"forced",
163162
e.schedule.scheduled_at == PgScrubber::scrub_must_stamp());
@@ -167,7 +166,6 @@ void ScrubQueue::dump_scrubs(ceph::Formatter* f) const
167166
: "deep");
168167
f->dump_stream("urgency") << fmt::format("{}", e.urgency);
169168
f->dump_bool("eligible", e.schedule.not_before <= query_time);
170-
f->dump_bool("overdue", e.schedule.deadline < query_time);
171169
f->dump_stream("last_issue") << fmt::format("{}", e.last_issue);
172170
},
173171
std::numeric_limits<int>::max());

src/osd/scrubber/pg_scrubber.cc

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -686,42 +686,6 @@ Scrub::sched_conf_t PgScrubber::populate_config_params() const
686686
configs.deep_interval =
687687
deep_pool > 0.0 ? deep_pool : conf->osd_deep_scrub_interval;
688688

689-
/**
690-
* 'max_shallow' is set to the maximum allowed delay between
691-
* scrubs. This deadline has almost no effect on scrub scheduling
692-
* (the only minor exception: when sorting two scrub jobs that are
693-
* equivalent in all but the deadline). It will be removed in
694-
* the next version.
695-
*
696-
* 'max_shallow' is controlled by a pool option and a configuration
697-
* parameter. Note that if the value configured is less than the
698-
* shallow interval (plus expenses), the max_shallow is disabled.
699-
*/
700-
auto max_shallow = pool_conf.value_or(pool_opts_t::SCRUB_MAX_INTERVAL, 0.0);
701-
if (max_shallow <= 0.0) {
702-
max_shallow = conf->osd_scrub_max_interval;
703-
}
704-
705-
if (max_shallow > 0.0) {
706-
const auto min_accepted_deadline =
707-
configs.shallow_interval *
708-
(1 + conf->osd_scrub_interval_randomize_ratio);
709-
710-
if (max_shallow >= min_accepted_deadline) {
711-
configs.max_shallow = max_shallow;
712-
} else {
713-
// this is a bit odd, but the pool option is set to a value
714-
// less than the interval. Keep the nullopt in max_shallow,
715-
dout(10) << fmt::format(
716-
"{}: configured 'max shallow' rejected as too low ({}/{} "
717-
"< {})",
718-
__func__,
719-
pool_conf.value_or(pool_opts_t::SCRUB_MAX_INTERVAL, 0.0),
720-
conf->osd_scrub_max_interval, min_accepted_deadline)
721-
<< dendl;
722-
}
723-
}
724-
725689
configs.interval_randomize_ratio = conf->osd_scrub_interval_randomize_ratio;
726690
configs.deep_randomize_ratio =
727691
conf.get_val<double>("osd_deep_scrub_interval_cv");
@@ -2125,7 +2089,6 @@ void PgScrubber::on_mid_scrub_abort(Scrub::delay_cause_t issue)
21252089
std::max(current_targ.urgency(), aborted_target.urgency());
21262090
curr_sched.scheduled_at =
21272091
std::min(curr_sched.scheduled_at, abrt_sched.scheduled_at);
2128-
curr_sched.deadline = std::min(curr_sched.deadline, abrt_sched.deadline);
21292092
curr_sched.not_before =
21302093
std::min(curr_sched.not_before, abrt_sched.not_before);
21312094

src/osd/scrubber/scrub_job.cc

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -110,20 +110,13 @@ void ScrubJob::adjust_shallow_schedule(
110110
if (ScrubJob::requires_randomization(shallow_target.urgency())) {
111111
utime_t adj_not_before = last_scrub;
112112
utime_t adj_target = last_scrub;
113-
sh_times.deadline = adj_target;
114113

115114
// add a random delay to the proposed scheduled time
116115
adj_target += app_conf.shallow_interval;
117116
double r = rand() / (double)RAND_MAX;
118117
adj_target +=
119-
app_conf.shallow_interval * app_conf.interval_randomize_ratio * r;
118+
app_conf.shallow_interval * app_conf.interval_randomize_ratio * r;
120119

121-
// the deadline can be updated directly into the scrub-job
122-
if (app_conf.max_shallow) {
123-
sh_times.deadline += *app_conf.max_shallow;
124-
} else {
125-
sh_times.deadline = utime_t::max();
126-
}
127120
if (adj_not_before < adj_target) {
128121
adj_not_before = adj_target;
129122
}
@@ -132,16 +125,13 @@ void ScrubJob::adjust_shallow_schedule(
132125

133126
} else {
134127

135-
// the target time is already set. Make sure to reset the n.b. and
136-
// the (irrelevant) deadline
128+
// the target time is already set. Make sure to reset the n.b.
137129
sh_times.not_before = sh_times.scheduled_at;
138-
sh_times.deadline = utime_t::max();
139130
}
140131

141132
dout(10) << fmt::format(
142-
"adjusted: nb:{:s} target:{:s} deadline:{:s} ({})",
143-
sh_times.not_before, sh_times.scheduled_at, sh_times.deadline,
144-
state_desc())
133+
"adjusted: nb:{:s} target:{:s} ({})", sh_times.not_before,
134+
sh_times.scheduled_at, state_desc())
145135
<< dendl;
146136
}
147137

@@ -253,7 +243,6 @@ void ScrubJob::adjust_deep_schedule(
253243
<< dendl;
254244

255245
auto& dp_times = deep_target.sched_info.schedule; // shorthand
256-
dp_times.deadline = utime_t::max(); // no 'max' for deep scrubs
257246

258247
if (ScrubJob::requires_randomization(deep_target.urgency())) {
259248
utime_t adj_target = last_deep;
@@ -369,7 +358,6 @@ void ScrubJob::dump(ceph::Formatter* f) const
369358
f->dump_stream("pgid") << pgid;
370359
f->dump_stream("sched_time") << get_sched_time();
371360
f->dump_stream("orig_sched_time") << sch.scheduled_at;
372-
f->dump_stream("deadline") << sch.deadline;
373361
f->dump_bool("forced", entry.urgency >= urgency_t::operator_requested);
374362
}
375363

src/osd/scrubber/scrub_job.h

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,6 @@ struct sched_conf_t {
3737
/// the desired interval between deep scrubs
3838
double deep_interval{0.0};
3939

40-
/**
41-
* the maximum interval between shallow scrubs, after which the
42-
* (info-only) "overdue" field in the scheduler dump is set.
43-
* Determined by either the pool or the cluster configuration.
44-
* Empty if no limit is configured.
45-
*/
46-
std::optional<double> max_shallow;
47-
4840
/**
4941
* interval_randomize_ratio
5042
*
@@ -212,16 +204,15 @@ class ScrubJob {
212204

213205
/**
214206
* Given a proposed time for the next scrub, and the relevant
215-
* configuration, adjust_schedule() determines the actual target time,
216-
* the deadline, and the 'not_before' time for the scrub.
207+
* configuration, adjust_schedule() determines the actual target time
208+
* and the 'not_before' time for the scrub.
217209
* The new values are updated into the scrub-job.
218210
*
219211
* Specifically:
220212
* - for high-priority scrubs: the 'not_before' is set to the
221213
* (untouched) proposed target time.
222214
* - for regular scrubs: the proposed time is adjusted (delayed) based
223-
* on the configuration; the deadline is set further out (if configured)
224-
* and the n.b. is reset to the target.
215+
* on the configuration; the n.b. is reset to the target.
225216
*/
226217
void adjust_shallow_schedule(
227218
utime_t last_scrub,
@@ -434,8 +425,8 @@ struct formatter<Scrub::sched_conf_t> {
434425
{
435426
return fmt::format_to(
436427
ctx.out(),
437-
"periods:s:{}/{},d:{},iv-ratio:{},deep-rand:{},on-inv:{}",
438-
cf.shallow_interval, cf.max_shallow.value_or(-1.0), cf.deep_interval,
428+
"periods:s:{},d:{},iv-ratio:{},deep-rand:{},on-inv:{}",
429+
cf.shallow_interval, cf.deep_interval,
439430
cf.interval_randomize_ratio, cf.deep_randomize_ratio,
440431
cf.mandatory_on_invalid);
441432
}

src/osd/scrubber/scrub_queue_entry.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ enum class urgency_t {
6060
* a specific scrub level. Namely - it identifies the [pg,level] combination,
6161
* the 'urgency' attribute of the scheduled scrub (which determines most of
6262
* its behavior and scheduling decisions) and the actual time attributes
63-
* for scheduling (target, deadline, not_before).
63+
* for scheduling (target time & not_before).
6464
*/
6565
struct SchedEntry {
6666
constexpr SchedEntry(spg_t pgid, scrub_level_t level)
@@ -78,7 +78,7 @@ struct SchedEntry {
7878

7979
urgency_t urgency{urgency_t::periodic_regular};
8080

81-
/// scheduled_at, not-before & the deadline times
81+
/// scheduled_at and not-before times
8282
Scrub::scrub_schedule_t schedule;
8383

8484
/// either 'none', or the reason for the latest failure/delay (for
@@ -211,9 +211,9 @@ struct formatter<Scrub::SchedEntry> {
211211
auto format(const Scrub::SchedEntry& st, FormatContext& ctx) const
212212
{
213213
return fmt::format_to(
214-
ctx.out(), "{}/{},nb:{:s},({},tr:{:s},dl:{:s})", st.pgid,
214+
ctx.out(), "{}/{},nb:{:s},({},tr:{:s})", st.pgid,
215215
(st.level == scrub_level_t::deep ? "dp" : "sh"), st.schedule.not_before,
216-
st.urgency, st.schedule.scheduled_at, st.schedule.deadline);
216+
st.urgency, st.schedule.scheduled_at);
217217
}
218218
};
219219
} // namespace fmt

src/osd/scrubber_common.h

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -124,26 +124,14 @@ enum class schedule_result_t {
124124
};
125125

126126
/// a collection of the basic scheduling information of a scrub target:
127-
/// target time to scrub, the 'not before' time, and a deadline.
127+
/// target time to scrub, and the 'not before'.
128128
struct scrub_schedule_t {
129129
/**
130130
* the time at which we are allowed to start the scrub. Never
131131
* decreasing after 'scheduled_at' is set.
132132
*/
133133
utime_t not_before{utime_t::max()};
134134

135-
/**
136-
* the 'deadline' is the time by which we expect the periodic scrub to
137-
* complete. It is determined by the SCRUB_MAX_INTERVAL pool configuration
138-
* and by osd_scrub_max_interval;
139-
* Note: the 'deadline' has only a limited effect on scheduling: when
140-
* comparing jobs having identical urgency and target time (scheduled_at'),
141-
* the job with the earlier 'deadline' is preferred.
142-
* Being past deadline also sets the 'overdue' flag in scrub
143-
* scheduling dumps.
144-
*/
145-
utime_t deadline{utime_t::max()};
146-
147135
/**
148136
* the 'scheduled_at' is the time at which we intended the scrub to be scheduled.
149137
* For periodic (regular) scrubs, it is set to the time of the last scrub
@@ -161,12 +149,9 @@ struct scrub_schedule_t {
161149
{
162150
// when compared - the 'not_before' is ignored, assuming
163151
// we never compare jobs with different eligibility status.
164-
auto cmp1 = scheduled_at <=> rhs.scheduled_at;
165-
if (cmp1 != 0) {
166-
return cmp1;
167-
}
168-
return deadline <=> rhs.deadline;
152+
return scheduled_at <=> rhs.scheduled_at;
169153
};
154+
170155
bool operator==(const scrub_schedule_t& rhs) const = default;
171156
};
172157

@@ -191,8 +176,7 @@ struct formatter<Scrub::OSDRestrictions> {
191176
constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); }
192177

193178
template <typename FormatContext>
194-
auto format(const Scrub::OSDRestrictions& conds, FormatContext& ctx) const
195-
{
179+
auto format(const Scrub::OSDRestrictions& conds, FormatContext& ctx) const {
196180
return fmt::format_to(
197181
ctx.out(), "<{}.{}.{}.{}.{}>",
198182
conds.max_concurrency_reached ? "max-scrubs" : "",
@@ -207,11 +191,9 @@ template <>
207191
struct formatter<Scrub::scrub_schedule_t> {
208192
constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); }
209193
template <typename FormatContext>
210-
auto format(const Scrub::scrub_schedule_t& sc, FormatContext& ctx) const
211-
{
194+
auto format(const Scrub::scrub_schedule_t& sc, FormatContext& ctx) const {
212195
return fmt::format_to(
213-
ctx.out(), "nb:{:s}(at:{:s},dl:{:s})", sc.not_before,
214-
sc.scheduled_at, sc.deadline);
196+
ctx.out(), "nb:{:s}(at:{:s})", sc.not_before, sc.scheduled_at);
215197
}
216198
};
217199

0 commit comments

Comments
 (0)