From 3bb8a7210a647ae0f074277d5c2a73f2719741e7 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 23 Jul 2019 11:22:23 -0500 Subject: [PATCH] osd: requeue ops when PG is no longer laggy When we get a lease_ack, leave the laggy state. Signed-off-by: Sage Weil --- src/osd/PeeringState.cc | 7 ++++--- src/osd/PeeringState.h | 1 + src/osd/PrimaryLogPG.cc | 15 +++++++++++++++ src/osd/PrimaryLogPG.h | 1 + 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index 4e511d6a406..e62aaa7139b 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -1155,10 +1155,11 @@ void PeeringState::proc_lease_ack(int from, const pg_lease_ack_t& a) } } if (was_min) { + auto old_ru = readable_until; recalc_readable_until(); -// if (pl->is_laggy() && readable_until > now) { -#warning fixme: wake up? - //} + if (now < old_ru) { + pl->recheck_readable(); + } } } diff --git a/src/osd/PeeringState.h b/src/osd/PeeringState.h index d486507c2ac..9c67ec52377 100644 --- a/src/osd/PeeringState.h +++ b/src/osd/PeeringState.h @@ -273,6 +273,7 @@ public: virtual ceph::signedspan get_mnow() = 0; virtual HeartbeatStampsRef get_hb_stamps(int peer) = 0; virtual void schedule_renew_lease(epoch_t plr, ceph::timespan delay) = 0; + virtual void recheck_readable() = 0; // ============ Flush state ================== /** diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index a048b43588a..21b0f4cfff3 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -786,6 +786,21 @@ bool PrimaryLogPG::check_laggy_requeue(OpRequestRef& op) return false; } +void PrimaryLogPG::recheck_readable() +{ + if (is_laggy()) { + auto ru = recovery_state.get_readable_until(); + auto mnow = osd->get_mnow(); + if (ru > mnow) { + dout(10) << __func__ << " no longer laggy (ru " << ru << " > mnow " << mnow + << ")" << dendl; + state_clear(PG_STATE_LAGGY); + publish_stats_to_osd(); + requeue_ops(waiting_for_readable); + } + } +} + bool PrimaryLogPG::pgls_filter(const PGLSFilter& filter, const hobject_t& sobj) { bufferlist bl; diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index 9b68c112352..17ea9fdb920 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -1875,6 +1875,7 @@ public: bool check_laggy(OpRequestRef& op); bool check_laggy_requeue(OpRequestRef& op); + void recheck_readable() override; bool is_backfill_target(pg_shard_t osd) const { return recovery_state.is_backfill_target(osd); -- 2.39.5