From: Matan Breizman Date: Tue, 29 Nov 2022 10:40:54 +0000 (+0000) Subject: osd/PeeringState: Add logs to can_serve_replica_read() X-Git-Tag: v19.0.0~1522^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8cfc870ad5b11d5dfa1d16e172a228492d56570d;p=ceph.git osd/PeeringState: Add logs to can_serve_replica_read() Signed-off-by: Matan Breizman --- diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index f25c8626741..8c7c15ee7e2 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -1404,6 +1404,25 @@ bool PeeringState::needs_backfill() const return false; } +/** +* Returns whether a particular object can be safely read on this replica +*/ +bool PeeringState::can_serve_replica_read(const hobject_t &hoid) +{ + ceph_assert(!is_primary()); + eversion_t min_last_complete_ondisk = get_min_last_complete_ondisk(); + if (!pg_log.get_log().has_write_since( + hoid, min_last_complete_ondisk)) { + psdout(20) << __func__ + << " can be safely read on this replica" << dendl; + return true; + } else { + psdout(20) << __func__ + << " can't read object on this replica" << dendl; + return false; + } +} + /* * Returns true unless there is a non-lost OSD in might_have_unfound. */ diff --git a/src/osd/PeeringState.h b/src/osd/PeeringState.h index b466a013e25..45a3c0a9cc3 100644 --- a/src/osd/PeeringState.h +++ b/src/osd/PeeringState.h @@ -2337,14 +2337,7 @@ public: bool needs_recovery() const; bool needs_backfill() const; - /** - * Returns whether a particular object can be safely read on this replica - */ - bool can_serve_replica_read(const hobject_t &hoid) { - ceph_assert(!is_primary()); - return !pg_log.get_log().has_write_since( - hoid, get_min_last_complete_ondisk()); - } + bool can_serve_replica_read(const hobject_t &hoid); /** * Returns whether the current acting set is able to go active