From: Kefu Chai Date: Mon, 22 Feb 2021 07:58:14 +0000 (+0800) Subject: crimson/osd: drop pending ops when pg interval changes X-Git-Tag: v17.1.0~2882^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3b6f962810766cad258910237684ccb405e4e4b2;p=ceph-ci.git crimson/osd: drop pending ops when pg interval changes fullfill the promises of pending ops when pg interval changes, so we can drop them if the primary osd is changed as well. note, this behavior depends on interruptable future. Signed-off-by: Kefu Chai --- diff --git a/src/crimson/osd/osd_operation_sequencer.h b/src/crimson/osd/osd_operation_sequencer.h index 3ce9d82827e..86662e5108b 100644 --- a/src/crimson/osd/osd_operation_sequencer.h +++ b/src/crimson/osd/osd_operation_sequencer.h @@ -61,9 +61,13 @@ public: }); } - void finish_op(OpRef& op, const spg_t& pgid) { + void finish_op(OpRef& op, const spg_t& pgid, bool interrutped) { assert(op->pos); - pg_ops.at(pgid).erase(*(op->pos)); + auto curr_op_pos = *(op->pos); + if (interrutped) { + curr_op_pos->second.set_value(); + } + pg_ops.at(pgid).erase(curr_op_pos); } private: std::map, OperationComparator>> pg_ops; diff --git a/src/crimson/osd/osd_operations/client_request.cc b/src/crimson/osd/osd_operations/client_request.cc index c1542564224..2642150d4e6 100644 --- a/src/crimson/osd/osd_operations/client_request.cc +++ b/src/crimson/osd/osd_operations/client_request.cc @@ -106,17 +106,19 @@ seastar::future<> ClientRequest::start() } }); }).then([this, opref, pgref]() mutable { - ors.finish_op(opref, pgref->get_pgid()); + ors.finish_op(opref, pgref->get_pgid(), false); return seastar::stop_iteration::yes; - }); - }).handle_exception_type([](crimson::common::actingset_changed& e) { - if (e.is_primary()) { - logger().debug("operation restart, acting set changed"); - return seastar::stop_iteration::no; - } else { - logger().debug("operation abort, up primary changed"); - return seastar::stop_iteration::yes; - } + }).handle_exception_type( + [opref, pgref, this](crimson::common::actingset_changed& e) mutable { + if (e.is_primary()) { + logger().debug("operation restart, acting set changed"); + return seastar::stop_iteration::no; + } else { + ors.finish_op(opref, pgref->get_pgid(), true); + logger().debug("operation abort, up primary changed"); + return seastar::stop_iteration::yes; + } + }); }); }); });