]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd/replicated_recovery_backend: prevent recovery/backfills from 60891/head
authorXuehan Xu <xuxuehan@qianxin.com>
Sun, 15 Dec 2024 08:17:03 +0000 (16:17 +0800)
committerXuehan Xu <xuxuehan@qianxin.com>
Mon, 6 Jan 2025 03:06:00 +0000 (11:06 +0800)
polluting the cache of the underlying futurized store

Signed-off-by: Xuehan Xu <xuxuehan@qianxin.com>
src/crimson/osd/pg_backend.cc
src/crimson/osd/pg_backend.h
src/crimson/osd/replicated_recovery_backend.cc

index a40b28caa8b6258b7acad7bf520106eb6c80ff87..79895de06de04663710228d23637709c556358d7 100644 (file)
@@ -1325,9 +1325,10 @@ maybe_get_omap_vals(
 PGBackend::ll_read_ierrorator::future<ceph::bufferlist>
 PGBackend::omap_get_header(
   const crimson::os::CollectionRef& c,
-  const ghobject_t& oid) const
+  const ghobject_t& oid,
+  uint32_t op_flags) const
 {
-  return store->omap_get_header(c, oid)
+  return store->omap_get_header(c, oid, op_flags)
     .handle_error(
       crimson::ct_error::enodata::handle([] {
        return seastar::make_ready_future<bufferlist>();
@@ -1340,10 +1341,13 @@ PGBackend::ll_read_ierrorator::future<>
 PGBackend::omap_get_header(
   const ObjectState& os,
   OSDOp& osd_op,
-  object_stat_sum_t& delta_stats) const
+  object_stat_sum_t& delta_stats,
+  uint32_t op_flags) const
 {
   if (os.oi.is_omap()) {
-    return omap_get_header(coll, ghobject_t{os.oi.soid}).safe_then_interruptible(
+    return omap_get_header(
+      coll, ghobject_t{os.oi.soid}, CEPH_OSD_OP_FLAG_FADVISE_DONTNEED
+    ).safe_then_interruptible(
       [&delta_stats, &osd_op] (ceph::bufferlist&& header) {
         osd_op.outdata = std::move(header);
         delta_stats.num_rd_kb += shift_round_up(osd_op.outdata.length(), 10);
@@ -1707,7 +1711,8 @@ PGBackend::fiemap(
   CollectionRef c,
   const ghobject_t& oid,
   uint64_t off,
-  uint64_t len)
+  uint64_t len,
+  uint32_t op_flags)
 {
   return store->fiemap(c, oid, off, len);
 }
index c24176a10e73b33b014446c4eeee735f40052a21..9c2230375b0cfb94e09f94974000c8fda8d84395 100644 (file)
@@ -315,7 +315,8 @@ public:
     CollectionRef c,
     const ghobject_t& oid,
     uint64_t off,
-    uint64_t len);
+    uint64_t len,
+    uint32_t op_flags = 0);
 
   write_iertr::future<> tmapput(
     ObjectState& os,
@@ -375,11 +376,13 @@ public:
     object_stat_sum_t& delta_stats);
   ll_read_ierrorator::future<ceph::bufferlist> omap_get_header(
     const crimson::os::CollectionRef& c,
-    const ghobject_t& oid) const;
+    const ghobject_t& oid,
+    uint32_t op_flags = 0) const;
   ll_read_ierrorator::future<> omap_get_header(
     const ObjectState& os,
     OSDOp& osd_op,
-    object_stat_sum_t& delta_stats) const;
+    object_stat_sum_t& delta_stats,
+    uint32_t op_flags = 0) const;
   interruptible_future<> omap_set_header(
     ObjectState& os,
     const OSDOp& osd_op,
index 76f24196b51f75e919e42975a9b46fa5a3a1ed7e..15ba03c239962d216d3d55a86ee0ccb1a3bc41e4 100644 (file)
@@ -568,14 +568,17 @@ ReplicatedRecoveryBackend::read_metadata_for_push_op(
     return seastar::make_ready_future<eversion_t>(ver);
   }
   return interruptor::make_interruptible(interruptor::when_all_succeed(
-      backend->omap_get_header(coll, ghobject_t(oid)).handle_error_interruptible<false>(
+      backend->omap_get_header(
+        coll, ghobject_t(oid), CEPH_OSD_OP_FLAG_FADVISE_DONTNEED
+      ).handle_error_interruptible<false>(
        crimson::os::FuturizedStore::Shard::read_errorator::all_same_way(
          [oid] (const std::error_code& e) {
          logger().debug("read_metadata_for_push_op, error {} when getting omap header: {}", e, oid);
          return seastar::make_ready_future<bufferlist>();
        })),
-      interruptor::make_interruptible(store->get_attrs(coll, ghobject_t(oid)))
-      .handle_error_interruptible<false>(
+      interruptor::make_interruptible(
+        store->get_attrs(coll, ghobject_t(oid), CEPH_OSD_OP_FLAG_FADVISE_DONTNEED)
+      ).handle_error_interruptible<false>(
        crimson::os::FuturizedStore::Shard::get_attrs_ertr::all_same_way(
          [oid] (const std::error_code& e) {
          logger().debug("read_metadata_for_push_op, error {} when getting attrs: {}", e, oid);
@@ -613,8 +616,14 @@ ReplicatedRecoveryBackend::read_object_for_push_op(
     return seastar::make_ready_future<uint64_t>(offset);
   }
   // 1. get the extents in the interested range
-  return interruptor::make_interruptible(backend->fiemap(coll, ghobject_t{oid},
-    0, copy_subset.range_end())).safe_then_interruptible(
+  return interruptor::make_interruptible(
+    backend->fiemap(
+      coll,
+      ghobject_t{oid},
+      0,
+      copy_subset.range_end(),
+      CEPH_OSD_OP_FLAG_FADVISE_DONTNEED)
+  ).safe_then_interruptible(
     [=, this](auto&& fiemap_included) mutable {
     interval_set<uint64_t> extents;
     try {
@@ -630,8 +639,12 @@ ReplicatedRecoveryBackend::read_object_for_push_op(
     push_op->data_included.span_of(extents, offset, max_len);
     // 3. read the truncated extents
     // TODO: check if the returned extents are pruned
-    return interruptor::make_interruptible(store->readv(coll, ghobject_t{oid},
-      push_op->data_included, 0));
+    return interruptor::make_interruptible(
+      store->readv(
+        coll,
+        ghobject_t{oid},
+        push_op->data_included,
+        CEPH_OSD_OP_FLAG_FADVISE_DONTNEED));
   }).safe_then_interruptible([push_op, range_end=copy_subset.range_end()](auto &&bl) {
     push_op->data.claim_append(std::move(bl));
     uint64_t recovered_to = 0;