From 46e18b9a2d224c6b65ab46a945bcbe26fcd078f6 Mon Sep 17 00:00:00 2001 From: Ronen Friedman Date: Sun, 28 Jan 2024 05:45:50 -0600 Subject: [PATCH] osd/scrub: control reservation queueing using a config option Signed-off-by: Ronen Friedman --- src/common/options/osd.yaml.in | 10 ++++++++++ src/osd/scrubber/scrub_machine.cc | 11 ++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/common/options/osd.yaml.in b/src/common/options/osd.yaml.in index c2281c00ece46..2a7bad84e7b1b 100644 --- a/src/common/options/osd.yaml.in +++ b/src/common/options/osd.yaml.in @@ -535,6 +535,16 @@ options: see_also: - osd_scrub_slow_reservation_response with_legacy: false +- name: osd_scrub_disable_reservation_queuing + type: bool + level: advanced + desc: Disable queuing of scrub reservations + long_desc: When set - scrub replica reservations are responded to immediately, with + either success or failure (the pre-Squid version behaviour). This configuration + option is introduced to support mixed-version clusters and debugging, and will + be removed in the next release. + default: false + with_legacy: false # where rados plugins are stored - name: osd_class_dir type: str diff --git a/src/osd/scrubber/scrub_machine.cc b/src/osd/scrubber/scrub_machine.cc index 57c0492ec2e42..ce4196e1ebbb1 100644 --- a/src/osd/scrubber/scrub_machine.cc +++ b/src/osd/scrubber/scrub_machine.cc @@ -941,7 +941,16 @@ sc::result ReplicaUnreserved::react(const ReplicaReserveReq& ev) DECLARE_LOCALS; // 'scrbr' & 'pg_id' aliases dout(10) << "ReplicaUnreserved::react(const ReplicaReserveReq&)" << dendl; - bool async_request = true && ev.m_op->get_req()->wait_for_resources /* && a config */; + const auto& m = *(ev.m_op->get_req()); + const auto async_disabled = scrbr->get_pg_cct()->_conf.get_val( + "osd_scrub_disable_reservation_queuing"); + const bool async_request = !async_disabled && m.wait_for_resources; + dout(15) << fmt::format( + "ReplicaUnreserved::react(const ReplicaReserveReq&): " + "request:{} disabled?:{} -> async? {}", m.wait_for_resources, + async_disabled, async_request) + << dendl; + switch (context().on_reserve_request(ev, async_request)) { case ReplicaReactCode::discard: return discard_event(); -- 2.39.5