From: Sage Weil Date: Fri, 24 Jul 2015 15:12:36 +0000 (-0400) Subject: osd/ReplicatedPG: fix comparator resets X-Git-Tag: v9.1.0~346^2~21 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1f15146856ce2ec6005ef511c9aab9d7dbc7914f;p=ceph.git osd/ReplicatedPG: fix comparator resets We need to take care not to clear() any of the maps or sets or else we'll lose the comparator. Signed-off-by: Sage Weil --- diff --git a/src/osd/PG.h b/src/osd/PG.h index ad8d117910e3..2a1cbd97c157 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -667,6 +667,14 @@ public: *this = BackfillInterval(bitwise); } + /// clear objects list only + void clear_objects() { + // make sure we preserve the allocator and ordering! + objects = map( + hobject_t::Comparator(sort_bitwise)); + } + + /// reinstantiate with a new start+end position and sort order void reset(hobject_t start, bool bitwise) { clear(bitwise); begin = end = start; diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 8a74c691961e..5d895ef0c7cd 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -2583,13 +2583,14 @@ void ReplicatedPG::do_scan( // Check that from is in backfill_targets vector assert(is_backfill_targets(from)); - BackfillInterval bi; + BackfillInterval& bi = peer_backfill_info[from]; bi.begin = m->begin; bi.end = m->end; bufferlist::iterator p = m->get_data().begin(); - ::decode(bi.objects, p); - peer_backfill_info[from] = bi; + // take care to preserve ordering! + bi.clear_objects(); + ::decode_noclear(bi.objects, p); if (waiting_on_backfill.erase(from)) { if (waiting_on_backfill.empty()) { @@ -9703,8 +9704,7 @@ int ReplicatedPG::recover_backfill( get_sort_bitwise()) <= 0 && !backfill_info.extends_to_end() && backfill_info.empty()) { hobject_t next = backfill_info.end; - backfill_info.clear(); - backfill_info.begin = next; + backfill_info.reset(next, get_sort_bitwise()); backfill_info.end = hobject_t::get_max(); update_range(&backfill_info, handle); backfill_info.trim(); @@ -10095,7 +10095,7 @@ void ReplicatedPG::scan_range( { assert(is_locked()); dout(10) << "scan_range from " << bi->begin << dendl; - bi->objects.clear(); // for good measure + bi->clear_objects(); vector ls; ls.reserve(max);