Skip to content

Commit 480b7c6

Browse files
committed
crimson/osd/../client_request: add note to can_serve_replica_read
can_serve_replica_read uses PGLog::has_write_since, when checking for writes we actually check if any pglog entry belongs to the head object. The only two pglog entries that are of a clone object are: 1) At creation (pg_log_entry_t::CLONE) 2) At trimming (See remove_or_update) In both cases, the there would be another pg log entry of the head. --- Add assertion in prepare_head_update to assert that the above is true. The obc passed to prepare_head_update (by OpsExecuter) could also be a clone object (after being resolved). However, write operations should only occur to head - so let's verify that. Signed-off-by: Matan Breizman <[email protected]>
1 parent 5744613 commit 480b7c6

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/crimson/osd/ops_executer.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -903,6 +903,7 @@ pg_log_entry_t OpsExecuter::prepare_head_update(
903903
{
904904
LOG_PREFIX(OpsExecuter::prepare_head_update);
905905
assert(obc->obs.oi.soid.snap >= CEPH_MAXSNAP);
906+
assert(obc->obs.oi.soid.is_head());
906907

907908
update_clone_overlap();
908909
if (cloning_ctx) {

src/crimson/osd/osd_operations/client_request.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ ClientRequest::interruptible_future<> ClientRequest::with_pg_process_interruptib
205205
co_await reply_op_error(pgref, -EAGAIN);
206206
co_return;
207207
} else if (!pg.get_peering_state().can_serve_replica_read(m->get_hobj())) {
208+
// Note: can_serve_replica_read checks for writes on the head object
209+
// as writes can only occur to head.
208210
DEBUGDPP("{}.{}: unstable write on replica, bouncing to primary",
209211
pg, *this, this_instance_id);
210212
pg.get_perf_logger().inc(l_osd_replica_read_redirect_conflict);

0 commit comments

Comments
 (0)