From: Sage Weil Date: Thu, 23 Jul 2015 20:30:19 +0000 (-0400) Subject: osd: dynamically vary sort order of BackfillInterval map X-Git-Tag: v9.1.0~346^2~23 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1d66bbf898ffe7e1f96598611fe522839ffa59dd;p=ceph.git osd: dynamically vary sort order of BackfillInterval map We initialize all BackfillIntervals when backfill starts. At that point we set the Comparator order via reset(). Signed-off-by: Sage Weil --- diff --git a/src/osd/PG.h b/src/osd/PG.h index e907ac7dda6..ad8d117910e 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -652,17 +652,23 @@ public: struct BackfillInterval { // info about a backfill interval on a peer eversion_t version; /// version at which the scan occurred - map objects; + map objects; + bool sort_bitwise; hobject_t begin; hobject_t end; + + BackfillInterval(bool bitwise=true) + : objects(hobject_t::Comparator(bitwise)), + sort_bitwise(bitwise) + {} /// clear content - void clear() { - *this = BackfillInterval(); + void clear(bool bitwise=true) { + *this = BackfillInterval(bitwise); } - void reset(hobject_t start) { - clear(); + void reset(hobject_t start, bool bitwise) { + clear(bitwise); begin = end = start; } @@ -677,7 +683,7 @@ public: } /// removes items <= soid and adjusts begin to the first object - void trim_to(const hobject_t &soid, bool sort_bitwise) { + void trim_to(const hobject_t &soid) { trim(); while (!objects.empty() && cmp(objects.begin()->first, soid, sort_bitwise) <= 0) { @@ -705,7 +711,8 @@ public: f->dump_stream("begin") << begin; f->dump_stream("end") << end; f->open_array_section("objects"); - for (map::const_iterator i = objects.begin(); + for (map::const_iterator i = + objects.begin(); i != objects.end(); ++i) { f->open_object_section("object"); diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index c89bc35b8e7..6726328c5bd 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -9645,12 +9645,16 @@ int ReplicatedPG::recover_backfill( // on_activate() was called prior to getting here assert(last_backfill_started == earliest_backfill()); new_backfill = false; + + // initialize BackfillIntervals (with proper sort order) for (set::iterator i = backfill_targets.begin(); i != backfill_targets.end(); ++i) { - peer_backfill_info[*i].reset(peer_info[*i].last_backfill); + peer_backfill_info[*i].reset(peer_info[*i].last_backfill, + get_sort_bitwise()); } - backfill_info.reset(last_backfill_started); + backfill_info.reset(last_backfill_started, + get_sort_bitwise()); } for (set::iterator i = backfill_targets.begin(); @@ -9679,10 +9683,9 @@ int ReplicatedPG::recover_backfill( ++i) { peer_backfill_info[*i].trim_to( MAX_HOBJ(peer_info[*i].last_backfill, last_backfill_started, - get_sort_bitwise()), - get_sort_bitwise()); + get_sort_bitwise())); } - backfill_info.trim_to(last_backfill_started, get_sort_bitwise()); + backfill_info.trim_to(last_backfill_started); hobject_t backfill_pos = MIN_HOBJ(backfill_info.begin, earliest_peer_backfill(),