From 993e2d5facbd866dea4c7d4c306d7f97a98dba93 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 17 Apr 2017 12:47:49 -0400 Subject: [PATCH] osd/osd_types: encode all_participants for pi_compact The all_participants is only updated on add_interval and cannot be rebuilt from the intervals vector alone since we only keep the smallset subset of peers to probe that we need. And it wasn't being encoded/decoded. Or dumped. Signed-off-by: Sage Weil --- src/osd/osd_types.cc | 8 +++++++- src/osd/osd_types.h | 11 +++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index f0d9deb73d02..b17670cb4515 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -3099,7 +3099,6 @@ class pi_compact_rep : public PastIntervals::interval_rep { epoch_t first = 0; epoch_t last = 0; // inclusive set all_participants; - list intervals; pi_compact_rep( bool ec_pool, @@ -3169,6 +3168,7 @@ public: ENCODE_START(1, 1, bl); ::encode(first, bl); ::encode(last, bl); + ::encode(all_participants, bl); ::encode(intervals, bl); ENCODE_FINISH(bl); } @@ -3176,6 +3176,7 @@ public: DECODE_START(1, bl); ::decode(first, bl); ::decode(last, bl); + ::decode(all_participants, bl); ::decode(intervals, bl); DECODE_FINISH(bl); } @@ -3183,6 +3184,11 @@ public: f->open_object_section("PastIntervals::compact_rep"); f->dump_stream("first") << first; f->dump_stream("last") << last; + f->open_array_section("all_participants"); + for (auto& i : all_participants) { + f->dump_object("pg_shard", i); + } + f->close_section(); f->open_array_section("intervals"); for (auto &&i: intervals) { i.dump(f); diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 965c099f1000..dcbce601dd02 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -139,6 +139,12 @@ struct pg_shard_t { } void encode(bufferlist &bl) const; void decode(bufferlist::iterator &bl); + void dump(Formatter *f) const { + f->dump_unsigned("osd", osd); + if (shard != shard_id_t::NO_SHARD) { + f->dump_unsigned("shard", shard); + } + } }; WRITE_CLASS_ENCODER(pg_shard_t) WRITE_EQ_OPERATORS_2(pg_shard_t, osd, shard) @@ -2898,6 +2904,7 @@ PastIntervals::PriorSet::PriorSet( } set all_probe = past_intervals.get_all_probe(ec_pool); + ldpp_dout(dpp, 10) << "build_prior all_probe " << all_probe << dendl; for (auto &&i: all_probe) { switch (f(0, i.osd, nullptr)) { case UP: { @@ -2963,8 +2970,8 @@ PastIntervals::PriorSet::PriorSet( // ensure that we haven't lost any information. if (!(*pcontdec)(up_now) && any_down_now) { // fixme: how do we identify a "clean" shutdown anyway? - ldpp_dout(dpp, 10) << "build_prior possibly went active+rw, insufficient up;" - << " including down osds" << dendl; + ldpp_dout(dpp, 10) << "build_prior possibly went active+rw," + << " insufficient up; including down osds" << dendl; assert(!candidate_blocked_by.empty()); pg_down = true; blocked_by.insert( -- 2.47.3