]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PeeringState: Add logs to can_serve_replica_read()
authorMatan Breizman <mbreizma@redhat.com>
Tue, 29 Nov 2022 10:40:54 +0000 (10:40 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Wed, 8 Mar 2023 13:23:23 +0000 (13:23 +0000)
Signed-off-by: Matan Breizman <mbreizma@redhat.com>
src/osd/PeeringState.cc
src/osd/PeeringState.h

index f25c86267417207f94a5083f205b38a435048484..8c7c15ee7e2ec72089a3ae5f73e1c2d3a8565ccf 100644 (file)
@@ -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.
  */
index b466a013e25fadf3173130968491941cb492ca86..45a3c0a9cc3fbba57f45e728cba9792294ceb397 100644 (file)
@@ -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