]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osd: implement BackfillRecoveryPipeline.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 12 May 2020 20:57:26 +0000 (22:57 +0200)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Mon, 13 Jul 2020 14:25:31 +0000 (16:25 +0200)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/osd/osd_operations/background_recovery.cc
src/crimson/osd/osd_operations/background_recovery.h
src/crimson/osd/pg.h

index f473e5a6ea5f824b03b5cbb9d611be09f480f75f..ae7f5c4258b370a18f240db466be90348653176d 100644 (file)
@@ -110,11 +110,23 @@ seastar::future<bool> PglogBasedRecovery::do_recovery()
 
 seastar::future<bool> BackfillRecovery::do_recovery()
 {
-  if (pg->has_reset_since(epoch_started))
+  logger().debug("{}", __func__);
+
+  if (pg->has_reset_since(epoch_started)) {
+    logger().debug("{}: pg got reset since epoch_started={}",
+                   __func__, epoch_started);
     return seastar::make_ready_future<bool>(false);
-  // FIXME: blocking future, limits
-  pg->get_recovery_handler()->dispatch_backfill_event(std::move(evt));
-  return seastar::make_ready_future<bool>(false);
+  }
+  // TODO: limits
+  return with_blocking_future(
+    // process_event() of our boost::statechart machine is non-reentrant.
+    // with the backfill_pipeline we protect it from a second entry from
+    // the implementation of BackfillListener.
+    handle.enter(pg->backfill_pipeline.process)
+  ).then([this] {
+    pg->get_recovery_handler()->dispatch_backfill_event(std::move(evt));
+    return seastar::make_ready_future<bool>(false);
+  });
 }
 
 } // namespace crimson::osd
index 235038544b9d7731495c08d53b1dab3a0e981a11..ae439b9300bfa6e4dc2a89c58723e38018c51293 100644 (file)
@@ -74,9 +74,17 @@ public:
 
 class BackfillRecovery final : public BackgroundRecovery {
   boost::intrusive_ptr<const boost::statechart::event_base> evt;
+  OrderedPipelinePhase::Handle handle;
   seastar::future<bool> do_recovery() override;
 
 public:
+  class BackfillRecoveryPipeline {
+    OrderedPipelinePhase process = {
+      "BackfillRecovery::PGPipeline::process"
+    };
+    friend class BackfillRecovery;
+  };
+
   template <class EventT>
   BackfillRecovery(
     Ref<PG> pg,
index 30b025d35d7bc525d5834373f7c9f36441536a44..58e17daeaf80e47d842dc4c6a63511af69333edb 100644 (file)
@@ -657,6 +657,7 @@ private:
   friend class PGAdvanceMap;
   friend class PeeringEvent;
   friend class RepRequest;
+  friend class BackfillRecovery;
   friend struct BackfillState::PGFacade;
 private:
   seastar::future<bool> find_unfound() {
@@ -675,6 +676,9 @@ private:
   const set<pg_shard_t> &get_actingset() const {
     return peering_state.get_actingset();
   }
+
+private:
+  BackfillRecovery::BackfillRecoveryPipeline backfill_pipeline;
 };
 
 std::ostream& operator<<(std::ostream&, const PG& pg);