]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/ReplicatedPG: fix trim of in-flight hit_sets
authorSage Weil <sage@inktank.com>
Fri, 2 May 2014 23:41:26 +0000 (16:41 -0700)
committerSage Weil <sage@inktank.com>
Wed, 7 May 2014 21:01:39 +0000 (14:01 -0700)
We normally need to stat the hit_set to know how many bytes to adjust the
stats by.  If the hit_set was just written, we will get ENOENT.

Get the obc instead, which will either get the in-memory copy (because the
repop is still in flight) or load it off of disk.

Fixes: #8283
Backport: firefly
Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 72fdd557c35cb721d4b502c5a8f68c878f11a19c)

src/osd/ReplicatedPG.cc

index ffa4d149832a100e5befdfff18210e4c07957c25..32e76b4e8856527b28512c9ca99405d7f27ce848 100644 (file)
@@ -10930,15 +10930,11 @@ void ReplicatedPG::hit_set_trim(RepGather *repop, unsigned max)
       agent_state->remove_oldest_hit_set();
     updated_hit_set_hist.history.pop_front();
 
-    struct stat st;
-    int r = osd->store->stat(
-      coll,
-      ghobject_t(oid, ghobject_t::NO_GEN, pg_whoami.shard),
-      &st);
-    assert(r == 0);
+    ObjectContextRef obc = get_object_context(oid, false);
+    assert(obc);
     --repop->ctx->delta_stats.num_objects;
     --repop->ctx->delta_stats.num_objects_hit_set_archive;
-    repop->ctx->delta_stats.num_bytes -= st.st_size;
+    repop->ctx->delta_stats.num_bytes -= obc->obs.oi.size;
   }
 }