osd/osd_types: pg_history_t: add prior_readable_until_ub

Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2019-06-18 13:22:10 -05:00
parent 3c9a28568f
commit caaf0f8eb6
2 changed files with 35 additions and 10 deletions

View File

@ -3237,7 +3237,7 @@ void pool_stat_t::generate_test_instances(list<pool_stat_t*>& o)
void pg_history_t::encode(ceph::buffer::list &bl) const
{
ENCODE_START(9, 4, bl);
ENCODE_START(10, 4, bl);
encode(epoch_created, bl);
encode(last_epoch_started, bl);
encode(last_epoch_clean, bl);
@ -3254,12 +3254,13 @@ void pg_history_t::encode(ceph::buffer::list &bl) const
encode(last_interval_started, bl);
encode(last_interval_clean, bl);
encode(epoch_pool_created, bl);
encode(prior_readable_until_ub, bl);
ENCODE_FINISH(bl);
}
void pg_history_t::decode(ceph::buffer::list::const_iterator &bl)
{
DECODE_START_LEGACY_COMPAT_LEN(9, 4, 4, bl);
DECODE_START_LEGACY_COMPAT_LEN(10, 4, 4, bl);
decode(epoch_created, bl);
decode(last_epoch_started, bl);
if (struct_v >= 3)
@ -3304,6 +3305,9 @@ void pg_history_t::decode(ceph::buffer::list::const_iterator &bl)
} else {
epoch_pool_created = epoch_created;
}
if (struct_v >= 10) {
decode(prior_readable_until_ub, bl);
}
DECODE_FINISH(bl);
}
@ -3325,6 +3329,9 @@ void pg_history_t::dump(Formatter *f) const
f->dump_stream("last_deep_scrub") << last_deep_scrub;
f->dump_stream("last_deep_scrub_stamp") << last_deep_scrub_stamp;
f->dump_stream("last_clean_scrub_stamp") << last_clean_scrub_stamp;
f->dump_float(
"prior_readable_until_ub",
std::chrono::duration<double>(prior_readable_until_ub).count());
}
void pg_history_t::generate_test_instances(list<pg_history_t*>& o)
@ -3338,6 +3345,7 @@ void pg_history_t::generate_test_instances(list<pg_history_t*>& o)
o.back()->last_epoch_clean = 3;
o.back()->last_interval_clean = 2;
o.back()->last_epoch_split = 4;
o.back()->prior_readable_until_ub = make_timespan(3.1415);
o.back()->same_up_since = 5;
o.back()->same_interval_since = 6;
o.back()->same_primary_since = 7;

View File

@ -2649,6 +2649,9 @@ struct pg_history_t {
utime_t last_deep_scrub_stamp;
utime_t last_clean_scrub_stamp;
/// upper bound on how long prior interval readable (relative to encode time)
ceph::timespan prior_readable_until_ub = ceph::timespan::zero();
friend bool operator==(const pg_history_t& l, const pg_history_t& r) {
return
l.epoch_created == r.epoch_created &&
@ -2666,7 +2669,8 @@ struct pg_history_t {
l.last_deep_scrub == r.last_deep_scrub &&
l.last_scrub_stamp == r.last_scrub_stamp &&
l.last_deep_scrub_stamp == r.last_deep_scrub_stamp &&
l.last_clean_scrub_stamp == r.last_clean_scrub_stamp;
l.last_clean_scrub_stamp == r.last_clean_scrub_stamp &&
l.prior_readable_until_ub == r.prior_readable_until_ub;
}
pg_history_t() {}
@ -2699,6 +2703,15 @@ struct pg_history_t {
}
if (last_interval_started < other.last_interval_started) {
last_interval_started = other.last_interval_started;
// if we are learning about a newer *started* interval, our
// readable_until_ub is obsolete
prior_readable_until_ub = other.prior_readable_until_ub;
modified = true;
} else if (other.last_interval_started == last_interval_started &&
other.prior_readable_until_ub < prior_readable_until_ub) {
// if other is the *same* interval, than pull our upper bound in
// if they have a tighter bound.
prior_readable_until_ub = other.prior_readable_until_ub;
modified = true;
}
if (last_epoch_clean < other.last_epoch_clean) {
@ -2748,12 +2761,16 @@ struct pg_history_t {
WRITE_CLASS_ENCODER(pg_history_t)
inline std::ostream& operator<<(std::ostream& out, const pg_history_t& h) {
return out << "ec=" << h.epoch_created << "/" << h.epoch_pool_created
<< " lis/c=" << h.last_interval_started
<< "/" << h.last_interval_clean
<< " les/c/f=" << h.last_epoch_started << "/" << h.last_epoch_clean
<< "/" << h.last_epoch_marked_full
<< " sis=" << h.same_interval_since;
out << "ec=" << h.epoch_created << "/" << h.epoch_pool_created
<< " lis/c=" << h.last_interval_started
<< "/" << h.last_interval_clean
<< " les/c/f=" << h.last_epoch_started << "/" << h.last_epoch_clean
<< "/" << h.last_epoch_marked_full
<< " sis=" << h.same_interval_since;
if (h.prior_readable_until_ub != ceph::timespan::zero()) {
out << " pruub=" << h.prior_readable_until_ub;
}
return out;
}