From: Kefu Chai Date: Sun, 23 Jun 2019 11:37:51 +0000 (+0800) Subject: crimson/osd: update peering_state in PG::on_activate_complete() X-Git-Tag: v15.1.0~2365^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F28747%2Fhead;p=ceph.git crimson/osd: update peering_state in PG::on_activate_complete() so that the PG can mark itself clean when it is activated and does not need recovery. Signed-off-by: Kefu Chai --- diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index ac276c23a71e..64d6fc3e62ad 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -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( + this, + shard_services, + pg_whoami, + pgid, + get_osdmap_epoch(), + get_osdmap_epoch(), + PeeringState::DoRecovery{}); + } else if (peering_state.needs_backfill()) { + shard_services.start_operation( + this, + shard_services, + pg_whoami, + pgid, + get_osdmap_epoch(), + get_osdmap_epoch(), + PeeringState::RequestBackfill{}); + } else { + shard_services.start_operation( + 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); } diff --git a/src/crimson/osd/pg.h b/src/crimson/osd/pg.h index 2e847a83c368..7fee35661454 100644 --- a/src/crimson/osd/pg.h +++ b/src/crimson/osd/pg.h @@ -256,10 +256,7 @@ public: void on_activate(interval_set 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 }