]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: PG::repair_object() doesn't depend on MOSDOp anymore.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 23 Mar 2021 20:45:17 +0000 (20:45 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Mon, 10 May 2021 16:01:32 +0000 (18:01 +0200)
Before this commit the method was depending on `MOSDOp::get_min_epoch()`
to start an `UrgentRecovery`. However, it seems `PG::get_osdmap_epoch()`
would be sufficient here as the very early stages of the processing
in `ClientRequest` ensure the PG fits the `get_min_epoch()` requirement.

In the classical OSD the counterpart code looks like below:

```
int PrimaryLogPG::rep_repair_primary_object(const hobject_t& soid, OpContext *ctx)
{
  // ...
  queue_peering_event(
      PGPeeringEventRef(
        std::make_shared<PGPeeringEvent>(
        get_osdmap_epoch(),
        get_osdmap_epoch(),
        PeeringState::DoRecovery())));

  return -EAGAIN;
}
```

In addition to the dependency minimalisation, the commits reformats
the code around `PG::repair_object()` to fit our guidelines.

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/osd/pg.cc
src/crimson/osd/pg.h

index 99d704bf207ab38324063cafa691f8e2e111f364..d7c4f87a659f6f63cce905f26ed1c871b6d4c8ff 100644 (file)
@@ -683,7 +683,6 @@ PG::interruptible_future<Ref<MOSDOpReply>> PG::handle_failed_op(
 }
 
 PG::interruptible_future<> PG::repair_object(
-  Ref<MOSDOp> m,
   const hobject_t& oid,
   eversion_t& v) 
 {
@@ -693,8 +692,8 @@ PG::interruptible_future<> PG::repair_object(
   // Add object to PG's missing set if it isn't there already
   assert(!get_local_missing().is_missing(oid));
   peering_state.force_object_missing(pg_whoami, oid, v);
-  auto [op, fut] = get_shard_services().start_operation<crimson::osd::UrgentRecovery>(
-               oid, v, this, get_shard_services(), m->get_min_epoch());
+  auto [op, fut] = get_shard_services().start_operation<UrgentRecovery>(
+    oid, v, this, get_shard_services(), get_osdmap_epoch());
   return std::move(fut);
 }
 
@@ -744,14 +743,13 @@ PG::do_osd_ops_iertr::future<Ret> PG::do_osd_ops_execute(
   }).safe_then_interruptible_tuple([success_func=std::move(success_func)] {
     return std::move(success_func)();
   }, crimson::ct_error::object_corrupted::handle(
-    [m, obc, rollbacker, this] (const std::error_code& e) mutable {
+    [obc, rollbacker, this] (const std::error_code& e) mutable {
     // this is a path for EIO. it's special because we want to fix the obejct
     // and try again. that is, the layer above `PG::do_osd_ops` is supposed to
     // restart the execution.
     return rollbacker.rollback_obc_if_modified(e).then_interruptible(
-      [m, obc, this] {
-      return repair_object(m,
-                           obc->obs.oi.soid,
+      [obc, this] {
+      return repair_object(obc->obs.oi.soid,
                            obc->obs.oi.version).then_interruptible([] {
         return do_osd_ops_iertr::future<Ret>{crimson::ct_error::eagain::make()};
       });
index 373f92562cc570341735e93daf5f2810f9ff1e1b..0e1d7fe1329cdad0f92ca385cafe20bf593cc953 100644 (file)
@@ -592,9 +592,9 @@ private:
                                       ObjectContextRef&& obc,
                                       ceph::os::Transaction&& txn,
                                       osd_op_params_t&& oop);
-  interruptible_future<> repair_object(Ref<MOSDOp> m,
-               const hobject_t& oid,
-               eversion_t& v);
+  interruptible_future<> repair_object(
+    const hobject_t& oid,
+    eversion_t& v);
 
 private:
   OSDMapGate osdmap_gate;