From: Matan Breizman Date: Thu, 27 Mar 2025 10:42:55 +0000 (+0000) Subject: osd/../client_request: relax replicated reads on clones X-Git-Tag: v20.3.0~151^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=95255f7d80f3e2eb3d19f08bd23617c41dbda2a7;p=ceph.git osd/../client_request: relax replicated reads on clones When handling a client request on a clone object, m->get_hobj() might not actually represent the "actual" object from the OSD's prespective. See: ObjectContext::resolve_oid for how this logic is handled. If this replica has any missing clone objects that are either this object head or any of this object's clones - drop this replicted read and bounce back to primary. We could possibly check if the head is not missing and then wait for resolve_oid to lookup for the actual clone object (Which might exist!). However, this seems to not be worth the complexity as the niche scenario of being able to serve reads while having (possibly) releated missing objects. Fixes (2/2): https://tracker.ceph.com/issues/70639 Signed-off-by: Matan Breizman --- diff --git a/src/crimson/osd/osd_operations/client_request.cc b/src/crimson/osd/osd_operations/client_request.cc index 925508cbd88..c9bb5657b6b 100644 --- a/src/crimson/osd/osd_operations/client_request.cc +++ b/src/crimson/osd/osd_operations/client_request.cc @@ -197,9 +197,10 @@ ClientRequest::interruptible_future<> ClientRequest::with_pg_process_interruptib } pg.get_perf_logger().inc(l_osd_replica_read); - if (pg.is_unreadable_object(m->get_hobj())) { - DEBUGDPP("{}.{}: {} missing on replica, bouncing to primary", - pg, *this, this_instance_id, m->get_hobj()); + if (pg.is_missing_head_and_clones(m->get_hobj())) { + DEBUGDPP("{}.{}: {} possibly missing head or clone object on replica," + " bouncing to primary", + pg, *this, this_instance_id, m->get_hobj()); pg.get_perf_logger().inc(l_osd_replica_read_redirect_missing); co_await reply_op_error(pgref, -EAGAIN); co_return; diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index 92611f217f9..2b772e5f799 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -1511,6 +1511,10 @@ void PG::context_registry_on_change() { } } +bool PG::is_missing_head_and_clones(const hobject_t &hoid) { + return peering_state.is_missing_any_head_or_clone_of(hoid); +} + bool PG::can_discard_op(const MOSDOp& m) const { if (m.get_map_epoch() < peering_state.get_info().history.same_primary_since) { diff --git a/src/crimson/osd/pg.h b/src/crimson/osd/pg.h index b6b7b672629..0a20f2c4d62 100644 --- a/src/crimson/osd/pg.h +++ b/src/crimson/osd/pg.h @@ -952,6 +952,10 @@ private: !peering_state.get_missing_loc().readable_with_acting( oid, get_actingset(), v); } + + // check if any head or clone of this object is missing + bool is_missing_head_and_clones(const hobject_t &hoid); + bool is_missing_on_peer( const pg_shard_t &peer, const hobject_t &soid) const {