mirror of
https://github.com/ceph/ceph
synced 2025-04-01 00:26:47 +00:00
osd/OSDMap: add last_purged_snaps_stamp to osd_xinfo_t
Record OSDs' last scrub of purged_snaps in the OSDMap. Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
6b26fcd1bd
commit
e4aed74cd4
@ -132,23 +132,31 @@ void osd_xinfo_t::dump(Formatter *f) const
|
||||
f->dump_int("laggy_interval", laggy_interval);
|
||||
f->dump_int("features", features);
|
||||
f->dump_unsigned("old_weight", old_weight);
|
||||
f->dump_stream("last_purged_snaps_scrub") << last_purged_snaps_scrub;
|
||||
}
|
||||
|
||||
void osd_xinfo_t::encode(ceph::buffer::list& bl) const
|
||||
void osd_xinfo_t::encode(ceph::buffer::list& bl, uint64_t enc_features) const
|
||||
{
|
||||
ENCODE_START(3, 1, bl);
|
||||
uint8_t v = 4;
|
||||
if (!HAVE_FEATURE(enc_features, SERVER_OCTOPUS)) {
|
||||
v = 3;
|
||||
}
|
||||
ENCODE_START(v, 1, bl);
|
||||
encode(down_stamp, bl);
|
||||
__u32 lp = laggy_probability * 0xfffffffful;
|
||||
encode(lp, bl);
|
||||
encode(laggy_interval, bl);
|
||||
encode(features, bl);
|
||||
encode(old_weight, bl);
|
||||
if (v >= 4) {
|
||||
encode(last_purged_snaps_scrub, bl);
|
||||
}
|
||||
ENCODE_FINISH(bl);
|
||||
}
|
||||
|
||||
void osd_xinfo_t::decode(ceph::buffer::list::const_iterator& bl)
|
||||
{
|
||||
DECODE_START(3, bl);
|
||||
DECODE_START(4, bl);
|
||||
decode(down_stamp, bl);
|
||||
__u32 lp;
|
||||
decode(lp, bl);
|
||||
@ -162,6 +170,9 @@ void osd_xinfo_t::decode(ceph::buffer::list::const_iterator& bl)
|
||||
decode(old_weight, bl);
|
||||
else
|
||||
old_weight = 0;
|
||||
if (struct_v >= 4) {
|
||||
decode(last_purged_snaps_scrub, bl);
|
||||
}
|
||||
DECODE_FINISH(bl);
|
||||
}
|
||||
|
||||
@ -180,7 +191,8 @@ ostream& operator<<(ostream& out, const osd_xinfo_t& xi)
|
||||
return out << "down_stamp " << xi.down_stamp
|
||||
<< " laggy_probability " << xi.laggy_probability
|
||||
<< " laggy_interval " << xi.laggy_interval
|
||||
<< " old_weight " << xi.old_weight;
|
||||
<< " old_weight " << xi.old_weight
|
||||
<< " last_purged_snaps_scrub " << xi.last_purged_snaps_scrub;
|
||||
}
|
||||
|
||||
// ----------------------------------
|
||||
@ -481,7 +493,7 @@ void OSDMap::Incremental::encode_classic(ceph::buffer::list& bl, uint64_t featur
|
||||
encode(new_up_cluster, bl, features);
|
||||
encode(cluster_snapshot, bl);
|
||||
encode(new_uuid, bl);
|
||||
encode(new_xinfo, bl);
|
||||
encode(new_xinfo, bl, features);
|
||||
encode(new_hb_front_up, bl, features);
|
||||
}
|
||||
|
||||
@ -622,7 +634,7 @@ void OSDMap::Incremental::encode(ceph::buffer::list& bl, uint64_t features) cons
|
||||
}
|
||||
encode(cluster_snapshot, bl);
|
||||
encode(new_uuid, bl);
|
||||
encode(new_xinfo, bl);
|
||||
encode(new_xinfo, bl, features);
|
||||
if (target_v < 7) {
|
||||
encode_addrvec_map_as_addr(new_hb_front_up, bl, features);
|
||||
} else {
|
||||
@ -2794,7 +2806,7 @@ void OSDMap::encode_classic(ceph::buffer::list& bl, uint64_t features) const
|
||||
encode(cluster_snapshot_epoch, bl);
|
||||
encode(cluster_snapshot, bl);
|
||||
encode(*osd_uuid, bl);
|
||||
encode(osd_xinfo, bl);
|
||||
encode(osd_xinfo, bl, features);
|
||||
encode(osd_addrs->hb_front_addrs, bl, features);
|
||||
}
|
||||
|
||||
@ -2947,7 +2959,7 @@ void OSDMap::encode(ceph::buffer::list& bl, uint64_t features) const
|
||||
encode(cluster_snapshot_epoch, bl);
|
||||
encode(cluster_snapshot, bl);
|
||||
encode(*osd_uuid, bl);
|
||||
encode(osd_xinfo, bl);
|
||||
encode(osd_xinfo, bl, features);
|
||||
if (target_v < 7) {
|
||||
encode_addrvec_pvec_as_addr(osd_addrs->hb_front_addrs, bl, features);
|
||||
} else {
|
||||
|
@ -92,16 +92,17 @@ struct osd_xinfo_t {
|
||||
__u32 laggy_interval; ///< average interval between being marked laggy and recovering
|
||||
uint64_t features; ///< features supported by this osd we should know about
|
||||
__u32 old_weight; ///< weight prior to being auto marked out
|
||||
utime_t last_purged_snaps_scrub; ///< last scrub of purged_snaps
|
||||
|
||||
osd_xinfo_t() : laggy_probability(0), laggy_interval(0),
|
||||
features(0), old_weight(0) {}
|
||||
|
||||
void dump(ceph::Formatter *f) const;
|
||||
void encode(ceph::buffer::list& bl) const;
|
||||
void encode(ceph::buffer::list& bl, uint64_t features) const;
|
||||
void decode(ceph::buffer::list::const_iterator& bl);
|
||||
static void generate_test_instances(std::list<osd_xinfo_t*>& o);
|
||||
};
|
||||
WRITE_CLASS_ENCODER(osd_xinfo_t)
|
||||
WRITE_CLASS_ENCODER_FEATURES(osd_xinfo_t)
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const osd_xinfo_t& xi);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "osd/OSDMap.h"
|
||||
TYPE(osd_info_t)
|
||||
TYPE(osd_xinfo_t)
|
||||
TYPE_FEATUREFUL(osd_xinfo_t)
|
||||
TYPE_FEATUREFUL_NOCOPY(OSDMap)
|
||||
TYPE_FEATUREFUL_STRAYDATA(OSDMap::Incremental)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user