From: Matan Breizman Date: Tue, 29 Nov 2022 10:51:58 +0000 (+0000) Subject: crimson/osd/pg: Expand can_discard_op on BALANCE/LOCALIZE reads X-Git-Tag: v19.0.0~1624^2~18 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=53e26d16ff386fc384fa1a4b6d631145e587b225;p=ceph.git crimson/osd/pg: Expand can_discard_op on BALANCE/LOCALIZE reads See: 69def1433d49bd8543e26e9f1ebf00dfbc5059bd Signed-off-by: Matan Breizman --- diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index 9044cd393e6b9..d0550a08a2f30 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -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); }