From 531dd77468a22246a8ee958e74f786194a161812 Mon Sep 17 00:00:00 2001 From: Guang Yang Date: Fri, 16 Oct 2015 22:47:25 +0000 Subject: [PATCH] osd: list_missing should query missing_loc.needs_recovery_map Fixes: 13441 Signed-off-by: Guang Yang --- src/osd/ReplicatedPG.cc | 46 +++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 4ebeb6a6233da..15bd8044f8926 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -815,37 +815,39 @@ int ReplicatedPG::do_command(cmdmap_t cmdmap, ostream& ss, } f->dump_int("num_missing", missing.num_missing()); f->dump_int("num_unfound", get_num_unfound()); - map::const_iterator p = missing.missing.upper_bound(offset); + const map &needs_recovery_map = + missing_loc.get_needs_recovery(); + map::const_iterator p = + needs_recovery_map.upper_bound(offset); { f->open_array_section("objects"); int32_t num = 0; bufferlist bl; - while (p != missing.missing.end() && num < cct->_conf->osd_command_max_records) { - f->open_object_section("object"); - { - f->open_object_section("oid"); - p->first.dump(f.get()); - f->close_section(); - } - p->second.dump(f.get()); // have, need keys - { - f->open_array_section("locations"); - if (missing_loc.needs_recovery(p->first)) { - for (set::iterator r = - missing_loc.get_locations(p->first).begin(); - r != missing_loc.get_locations(p->first).end(); - ++r) - f->dump_stream("shard") << *r; + for (; p != needs_recovery_map.end() && num < cct->_conf->osd_command_max_records; ++p) { + if (missing_loc.is_unfound(p->first)) { + f->open_object_section("object"); + { + f->open_object_section("oid"); + p->first.dump(f.get()); + f->close_section(); + } + p->second.dump(f.get()); // have, need keys + { + f->open_array_section("locations"); + for (set::iterator r = + missing_loc.get_locations(p->first).begin(); + r != missing_loc.get_locations(p->first).end(); + ++r) + f->dump_stream("shard") << *r; + f->close_section(); } f->close_section(); - } - f->close_section(); - ++p; - num++; + num++; + } } f->close_section(); } - f->dump_int("more", p != missing.missing.end()); + f->dump_int("more", p != needs_recovery_map.end()); f->close_section(); f->flush(odata); return 0; -- 2.39.5