From: Brad Hubbard Date: Mon, 9 Oct 2017 07:24:17 +0000 (+1000) Subject: osd: Move creation of 'master_set' to scrub_compare_maps X-Git-Tag: v13.0.1~425^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=63ef97b3db81c0c725119943c8594a4a0d12154e;p=ceph-ci.git osd: Move creation of 'master_set' to scrub_compare_maps Moving it to scrub_compare_maps allows us to pass it to multiple subsequently called functions. Signed-off-by: Brad Hubbard --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 04893e987fd..e23316da4fa 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -4641,6 +4641,30 @@ void PG::scrub_compare_maps() pair, boost::optional>> missing_digest; + map maps; + maps[pg_whoami] = &scrubber.primary_scrubmap; + + for (set::iterator i = actingbackfill.begin(); + i != actingbackfill.end(); + ++i) { + if (*i == pg_whoami) continue; + dout(2) << __func__ << " replica " << *i << " has " + << scrubber.received_maps[*i].objects.size() + << " items" << dendl; + maps[*i] = &scrubber.received_maps[*i]; + } + + map::const_iterator i; + map::const_iterator j; + set master_set; + + // Construct master set + for (j = maps.begin(); j != maps.end(); ++j) { + for (i = j->second->objects.begin(); i != j->second->objects.end(); ++i) { + master_set.insert(i->first); + } + } + if (acting.size() > 1) { dout(10) << __func__ << " comparing replica scrub maps" << dendl; @@ -4648,24 +4672,13 @@ void PG::scrub_compare_maps() // Map from object with errors to good peer map> authoritative; - map maps; dout(2) << __func__ << " osd." << acting[0] << " has " << scrubber.primary_scrubmap.objects.size() << " items" << dendl; - maps[pg_whoami] = &scrubber.primary_scrubmap; - - for (set::iterator i = actingbackfill.begin(); - i != actingbackfill.end(); - ++i) { - if (*i == pg_whoami) continue; - dout(2) << __func__ << " replica " << *i << " has " - << scrubber.received_maps[*i].objects.size() - << " items" << dendl; - maps[*i] = &scrubber.received_maps[*i]; - } get_pgbackend()->be_compare_scrubmaps( maps, + master_set, state_test(PG_STATE_REPAIR), scrubber.missing, scrubber.inconsistent, diff --git a/src/osd/PGBackend.cc b/src/osd/PGBackend.cc index 04121f4b88e..7866fa9990d 100644 --- a/src/osd/PGBackend.cc +++ b/src/osd/PGBackend.cc @@ -904,6 +904,7 @@ out: void PGBackend::be_compare_scrubmaps( const map &maps, + const set &master_set, bool repair, map> &missing, map> &inconsistent, @@ -916,18 +917,8 @@ void PGBackend::be_compare_scrubmaps( const vector &acting, ostream &errorstream) { - map::const_iterator i; - map::const_iterator j; - set master_set; utime_t now = ceph_clock_now(); - // Construct master set - for (j = maps.begin(); j != maps.end(); ++j) { - for (i = j->second->objects.begin(); i != j->second->objects.end(); ++i) { - master_set.insert(i->first); - } - } - // Check maps against master set and each other for (set::const_iterator k = master_set.begin(); k != master_set.end(); @@ -960,7 +951,7 @@ void PGBackend::be_compare_scrubmaps( set cur_missing; set cur_inconsistent; - for (j = maps.begin(); j != maps.end(); ++j) { + for (auto j = maps.cbegin(); j != maps.cend(); ++j) { if (j == auth) shard_map[auth->first].selected_oi = true; if (j->second->objects.count(*k)) { diff --git a/src/osd/PGBackend.h b/src/osd/PGBackend.h index b9604dd2729..d832faf2852 100644 --- a/src/osd/PGBackend.h +++ b/src/osd/PGBackend.h @@ -572,6 +572,7 @@ typedef ceph::shared_ptr OSDMapRef; inconsistent_obj_wrapper &object_error); void be_compare_scrubmaps( const map &maps, + const set &master_set, bool repair, map> &missing, map> &inconsistent,