]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/ReplicatedPG: skip missing hit_sets when loading into memory 1655/head
authorSage Weil <sage@inktank.com>
Fri, 11 Apr 2014 20:14:58 +0000 (13:14 -0700)
committerSage Weil <sage@inktank.com>
Fri, 11 Apr 2014 20:14:58 +0000 (13:14 -0700)
We weren't handling hit_sets that were missing.

Two changes here:

1- Load the hit_sets oldest to newest.  That means that if we stop partway
   through loading, and then add another to the end of the list, and then
   try again to load some more, we will still catch them all.
2- If the object is missing, stop.  We'll try again the next time
   agent_work() is called.

Fixes: #8077
Signed-off-by: Sage Weil <sage@inktank.com>
src/osd/ReplicatedPG.cc

index 90eb87a549f13285de5dd8448b2cd56cef854933..9095df4ca3f1789621cc49df5b7ab1349eacebeb 100644 (file)
@@ -10839,9 +10839,8 @@ void ReplicatedPG::agent_load_hit_sets()
 
   if (agent_state->hit_set_map.size() < info.hit_set.history.size()) {
     dout(10) << __func__ << dendl;
-    for (list<pg_hit_set_info_t>::reverse_iterator p =
-          info.hit_set.history.rbegin();
-        p != info.hit_set.history.rend(); ++p) {
+    for (list<pg_hit_set_info_t>::iterator p = info.hit_set.history.begin();
+        p != info.hit_set.history.end(); ++p) {
       if (agent_state->hit_set_map.count(p->begin.sec()) == 0) {
        dout(10) << __func__ << " loading " << p->begin << "-"
                 << p->end << dendl;
@@ -10854,16 +10853,22 @@ void ReplicatedPG::agent_load_hit_sets()
        // check if it's still in flight
        if (hit_set_flushing.count(p->begin)) {
          agent_state->add_hit_set(p->begin.sec(), hit_set_flushing[p->begin]);
-       } else {
-         bufferlist bl;
-         hobject_t oid = get_hit_set_archive_object(p->begin, p->end);
-         int r = osd->store->read(coll, oid, 0, 0, bl);
-         assert(r >= 0);
-         HitSetRef hs(new HitSet);
-         bufferlist::iterator pbl = bl.begin();
-         ::decode(*hs, pbl);
-         agent_state->add_hit_set(p->begin.sec(), hs);
+         continue;
        }
+
+       hobject_t oid = get_hit_set_archive_object(p->begin, p->end);
+       if (is_unreadable_object(oid)) {
+         dout(10) << __func__ << " unreadable " << oid << ", waiting" << dendl;
+         break;
+       }
+
+       bufferlist bl;
+       int r = osd->store->read(coll, oid, 0, 0, bl);
+       assert(r >= 0);
+       HitSetRef hs(new HitSet);
+       bufferlist::iterator pbl = bl.begin();
+       ::decode(*hs, pbl);
+       agent_state->add_hit_set(p->begin.sec(), hs);
       }
     }
   }