From 823b3404e618f02214787d11c822421842e43e35 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sun, 23 Jun 2019 19:37:51 +0800 Subject: [PATCH] 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 --- src/crimson/osd/pg.cc | 35 +++++++++++++++++++++++++++++++++++ src/crimson/osd/pg.h | 5 +---- 2 files changed, 36 insertions(+), 4 deletions(-) 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 } -- 2.47.3