From ca80c3fc213f8c82b1805cb9d866caf6f167253a Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 23 Jul 2019 14:01:34 -0500 Subject: [PATCH] osd: send ops back to primary if replica is not readable This is the simplest strategy--much simpler than queueing them and waking them up again later. Signed-off-by: Sage Weil --- src/osd/PeeringState.cc | 3 ++- src/osd/PrimaryLogPG.cc | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index 98e70ac1f36ca..07c0e252b367d 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -1145,7 +1145,8 @@ void PeeringState::proc_lease(const pg_lease_t& l) if (ru > readable_until) { readable_until = ru; psdout(20) << __func__ << " readable_until now " << readable_until << dendl; -#warning fixme: wake up replica? + // NOTE: if we ever decide to block/queue ops on the replica, + // we'll need to wake them up here. } ceph::signedspan ruub; diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index de99a66acb95a..2947c51f37c6d 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -767,6 +767,11 @@ bool PrimaryLogPG::check_laggy(OpRequestRef& op) << " mnow " << mnow << " > readable_until " << ru << dendl; + if (!is_primary()) { + osd->reply_op_error(op, -EAGAIN); + return false; + } + // go to laggy state state_set(PG_STATE_LAGGY); publish_stats_to_osd(); -- 2.39.5