crimson/osd: add can_discard_op method for detecting "discardable" client requests

Signed-off-by: Xuehan Xu <xxhdx1985126@gmail.com>
This commit is contained in:
Xuehan Xu 2020-09-08 12:36:41 +08:00
parent e9ac113f4f
commit 2c17bc1933
3 changed files with 7 additions and 3 deletions

View File

@ -69,9 +69,7 @@ seastar::future<> ClientRequest::start()
return with_blocking_future(osd.wait_for_pg(m->get_spg()));
}).then([this, opref](Ref<PG> pgref) {
PG &pg = *pgref;
if (__builtin_expect(m->get_map_epoch()
< pg.get_info().history.same_primary_since,
false)) {
if (pg.can_discard_op(*m)) {
return osd.send_incremental_map(conn.get(), m->get_map_epoch());
}
return with_blocking_future(

View File

@ -993,4 +993,9 @@ void PG::on_change(ceph::os::Transaction &t) {
backend->on_actingset_changed({ is_primary() });
}
bool PG::can_discard_op(const MOSDOp& m) const {
return __builtin_expect(m.get_map_epoch()
< peering_state.get_info().history.same_primary_since, false);
}
}

View File

@ -672,6 +672,7 @@ private:
template <typename MsgType>
bool can_discard_replica_op(const MsgType& m) const;
bool can_discard_op(const MOSDOp& m) const;
bool is_missing_object(const hobject_t& soid) const {
return peering_state.get_pg_log().get_missing().get_items().count(soid);
}