]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: update peering_state in PG::on_activate_complete() 28747/head
authorKefu Chai <kchai@redhat.com>
Sun, 23 Jun 2019 11:37:51 +0000 (19:37 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 25 Jun 2019 16:18:48 +0000 (00:18 +0800)
so that the PG can mark itself clean when it is activated and does not
need recovery.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/osd/pg.cc
src/crimson/osd/pg.h

index ac276c23a71e526426b9aeca099896e4e6a0c40b..64d6fc3e62ad5260dea5390947f41d2116b0cc3e 100644 (file)
@@ -124,6 +124,41 @@ bool PG::try_flush_or_schedule_async() {
   return false;
 }
 
+void PG::on_activate_complete()
+{
+  active_promise.set_value();
+  active_promise = {};
+
+  if (peering_state.needs_recovery()) {
+    shard_services.start_operation<LocalPeeringEvent>(
+      this,
+      shard_services,
+      pg_whoami,
+      pgid,
+      get_osdmap_epoch(),
+      get_osdmap_epoch(),
+      PeeringState::DoRecovery{});
+  } else if (peering_state.needs_backfill()) {
+    shard_services.start_operation<LocalPeeringEvent>(
+      this,
+      shard_services,
+      pg_whoami,
+      pgid,
+      get_osdmap_epoch(),
+      get_osdmap_epoch(),
+      PeeringState::RequestBackfill{});
+  } else {
+    shard_services.start_operation<LocalPeeringEvent>(
+      this,
+      shard_services,
+      pg_whoami,
+      pgid,
+      get_osdmap_epoch(),
+      get_osdmap_epoch(),
+      PeeringState::AllReplicasRecovered{});
+  }
+}
+
 void PG::log_state_enter(const char *state) {
   logger().info("Entering state: {}", state);
 }
index 2e847a83c3681bbedd80972f5539ed9b2edc6978..7fee356614546294470e6f06eba1225d466212e7 100644 (file)
@@ -256,10 +256,7 @@ public:
   void on_activate(interval_set<snapid_t> to_trim) final {
     // Not needed yet (will be needed for IO unblocking)
   }
-  void on_activate_complete() final {
-    active_promise.set_value();
-    active_promise = {};
-  }
+  void on_activate_complete() final;
   void on_new_interval() final {
     // Not needed yet
   }