]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/ReplicatedPG: fix comparator resets
authorSage Weil <sage@redhat.com>
Fri, 24 Jul 2015 15:12:36 +0000 (11:12 -0400)
committerSage Weil <sage@redhat.com>
Fri, 7 Aug 2015 14:16:06 +0000 (10:16 -0400)
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 <sage@redhat.com>
src/osd/PG.h
src/osd/ReplicatedPG.cc

index ad8d117910e3332faf00c7d1847c5cb9b684c22b..2a1cbd97c157d5029b219958356b7511493574e2 100644 (file)
@@ -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,eversion_t,hobject_t::Comparator>(
+        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;
index 8a74c691961e9eee420c5fc28cb437e895315772..5d895ef0c7cd7f44b908bfe980dd5d905edf09aa 100644 (file)
@@ -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<hobject_t> ls;
   ls.reserve(max);