]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd/pg: Expand can_discard_op on BALANCE/LOCALIZE reads
authorMatan Breizman <mbreizma@redhat.com>
Tue, 29 Nov 2022 10:51:58 +0000 (10:51 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Sun, 21 May 2023 08:12:28 +0000 (08:12 +0000)
See: 69def1433d49bd8543e26e9f1ebf00dfbc5059bd

Signed-off-by: Matan Breizman <mbreizma@redhat.com>
(cherry picked from commit 53e26d16ff386fc384fa1a4b6d631145e587b225)

src/crimson/osd/pg.cc

index 9044cd393e6b9c8baa365dd57e8de1b230c57da5..d0550a08a2f309a0335aabe12f4751391549e6e0 100644 (file)
@@ -1378,6 +1378,19 @@ void PG::on_change(ceph::os::Transaction &t) {
 }
 
 bool PG::can_discard_op(const MOSDOp& m) const {
+  if ((m.get_flags() & (CEPH_OSD_FLAG_BALANCE_READS |
+                        CEPH_OSD_FLAG_LOCALIZE_READS))
+    && !is_primary()
+    && (m.get_map_epoch() <
+        peering_state.get_info().history.same_interval_since))
+    {
+      // Note: the Objecter will resend on interval change without the primary
+      // changing if it actually sent to a replica.  If the primary hasn't
+      // changed since the send epoch, we got it, and we're primary, it won't
+      // have resent even if the interval did change as it sent it to the primary
+      // (us).
+      return true;
+    }
   return __builtin_expect(m.get_map_epoch()
       < peering_state.get_info().history.same_primary_since, false);
 }