From 6f35c883e67686100777c4b8f15d395ffcecc92b Mon Sep 17 00:00:00 2001 From: Matan Breizman Date: Tue, 29 Nov 2022 10:51:58 +0000 Subject: [PATCH] crimson/osd/pg: Expand can_discard_op on BALANCE/LOCALIZE reads See: 69def1433d49bd8543e26e9f1ebf00dfbc5059bd Signed-off-by: Matan Breizman (cherry picked from commit 53e26d16ff386fc384fa1a4b6d631145e587b225) --- src/crimson/osd/pg.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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); } -- 2.39.5