Skip to content

osdc: fix ReplicaSplitOp read - #70207

Merged
tchaikov merged 4 commits into
ceph:mainfrom
sunyuechi:wip-replica-split-op-read
Sep 29, 2026
Merged

tchaikov merged 4 commits into
ceph:mainfrom
sunyuechi:wip-replica-split-op-read

Conversation

@sunyuechi

@sunyuechi sunyuechi commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

ReplicaSplitOp splits a large replicated-pool read across replicas.
Chunks were distributed starting from a random replica yet reassembled in
ascending acting-index order, so a wrapped window returned its chunks out of
order; a rounded-down chunk size could also emit an extra chunk that reused
another sub-read's buffer. Both silently corrupt the read. Separately, a
multi-op request may carry a read below the minimum split size, since only
one op in the request has to reach it; such an op divided by zero and then
threw std::out_of_range from a destructor, terminating the client.

These bugs are in the SplitOp (default off).

Tests are added with patterned data, since the existing all-zero tests
cannot detect misordered reassembly.

Tracker: https://tracker.ceph.com/issues/78329

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

16 similar comments
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@tchaikov

Copy link
Copy Markdown
Contributor

ok to test

@tchaikov

Copy link
Copy Markdown
Contributor

@aainscow hi Alex, could you take a look? these fix looks correct to me, but since f0115fa is included by umbrella. and a backport would need a tracker ticket. Before I prepare one: is replica split read meant to be production ready in v21? The pool flag auto-enables at require_osd_release >= umbrella, so only osd_min_split_replica_read_size=0 keeps the path dormant. if you intend it enabled, i will file a tracker ticket to facilitate the backport process.

@aainscow

Copy link
Copy Markdown
Contributor

@aainscow hi Alex, could you take a look? these fix looks correct to me, but since f0115fa is included by umbrella. and a backport would need a tracker ticket. Before I prepare one: is replica split read meant to be production ready in v21? The pool flag auto-enables at require_osd_release >= umbrella, so only osd_min_split_replica_read_size=0 keeps the path dormant. if you intend it enabled, i will file a tracker ticket to facilitate the backport process.

Replica Split Ops are disabled by default, although we had only seen performance issues with them on busy systems.

The nature of this bug suggests that our testing has not been good enough and we need to improve that before accepting this.

@aainscow

Copy link
Copy Markdown
Contributor

@aainscow

Copy link
Copy Markdown
Contributor

Please note that we are taking this seriously and are still investigating why this was not detected by our teuthology testing. Before I accept the fix, I want to make sure that we have recreated the issues in teuthology, so we have more confidence in our testing going forward.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@sunyuechi
sunyuechi force-pushed the wip-replica-split-op-read branch from 6817f58 to 41a8751 Compare August 10, 2026 07:36
@tchaikov

Copy link
Copy Markdown
Contributor

jenkins test signed

@tchaikov

Copy link
Copy Markdown
Contributor

jenkins test submodules

@CJamesIBM

Copy link
Copy Markdown
Contributor

Related to 2 below PR's. First one contains an additional fix to replica split ops, the second adds more support for testing replica split ops through Teuthology.

#71798
#71799

@SrinivasaBharath

Copy link
Copy Markdown
Contributor

This PR has been added to wip-bharath22-testing-20260917.055008-main.

@aainscow aainscow left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have improved teuthology tests and we are ready for these fixes now (once RADOS approved)

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

ReplicaSplitOp::init_read() distributed chunks over a window of acting
indices starting at the random reference_sub_read and wrapping at the
OSD count. This broke reads in two ways:

- assemble_buffer_read() concatenates sub-read buffers in ascending
  acting-index order, but chunks were assigned in window order, so a
  wrapped window was reassembled in the wrong order.

- chunk_size rounded the division down, which can produce one more
  chunk than slice_count. The extra chunk wrapped the window fully
  around and attached a second read sharing one output buffer to the
  first sub-read.

Round the division up, and distribute the chunks over an explicit
window of valid acting indices assigned in ascending order.
init_reference_sub_read() now collects those indices and picks one of
them, matching ECSplitOp.

Signed-off-by: Sun Yuechi <[email protected]>
Splitting validation only requires one op in a request to reach the
minimum split size, so a multi-op request may carry a shorter read.
ReplicaSplitOp::init_read() crashed on a division by zero for such an
op; clamp slice_count to one, serving it whole from the reference OSD.

The op then holds details on the reference sub-read only, but
assemble_buffer_read() and assemble_buffer_sparse_read() called
details.at(ops_index) on every sub-read; mini_flat_map::at() throws
std::out_of_range for a missing key, and complete() runs from the
destructor, so such a request terminated the client. Skip sub-reads
that did not take part in the op.

Signed-off-by: Sun Yuechi <[email protected]>
Add replica split-op regression tests using patterned data; the
existing tests write zeros, which cannot detect misordered
reassembly. The new cases cover a wrapped chunk window, an
unaligned length producing more chunks than slices, and a read
below the minimum split size in a multi-op request.

Signed-off-by: Sun Yuechi <[email protected]>
create() clears BALANCE_READS and pins pgid before it knows whether
the split goes ahead, and _calc_target() short-circuits once pgid is
set. A request that aborts after that point is sent to the primary
with the balanced-read flag lost. Restore the target on every path
that gives up on the split.

Signed-off-by: Sun Yuechi <[email protected]>
@sunyuechi

Copy link
Copy Markdown
Contributor Author

Resolved conflicts, dropped the replicated-pool early return in prepare_single_op() and the SingleChunkAfterPageRoundup test.

@SrinivasaBharath

Copy link
Copy Markdown
Contributor

This PR has been added to wip-bharath3-testing-20260918.154843-main.

@SrinivasaBharath

Copy link
Copy Markdown
Contributor

This PR has been removed from wip-bharath22-testing-20260917.055008-main.

@kamoltat

Copy link
Copy Markdown
Member

@tchaikov

Copy link
Copy Markdown
Contributor

jenkins test make check

@tchaikov
tchaikov merged commit 713255d into ceph:main Sep 29, 2026
16 checks passed
@tchaikov

tchaikov commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

@aainscow hi Alex, i just merged this PR, but he associated tracker ticket is not assigned. and its "Backport" field is empty. is this expected? i just changed its status to "Pending Backport", as i assumed that we plan to backport this fix. but seems it's not quite ready to be picked up by the bot or the script.

@aainscow

Copy link
Copy Markdown
Contributor

@aainscow hi Alex, i just merged this PR, but he associated tracker ticket is not assigned. and its "Backport" field is empty. is this expected? i just changed its status to "Pending Backport", as i assumed that we plan to backport this fix. but seems it's not quite ready to be picked up by the bot or the script.

It was on our radar, but I had not correctly filled in the backport of the tracker - fixed now.

sunyuechi added a commit to sunyuechi/openRuyi that referenced this pull request Oct 28, 2026
The new snapshot brings in these fixes:
- osd/PeeringState: fix the divergence check against olog.head
  (ceph/ceph#70149)
- osd: assert OI_ATTR is present in rollback_setattrs (ceph/ceph#70965)
- osdc: fix ReplicaSplitOp chunk distribution, reassembly and
  small multi-op reads (ceph/ceph#70207)
- erasure-code/isa: default the technique when the profile has none
  (ceph/ceph#72215)
- mount.ceph: report kernels without aes256k key support
  (ceph/ceph#72159)
- rgw/es: require both major and minor in the ES version
  (ceph/ceph#70007)
- build: turn WITH_RADOSGW_LANCEDB off where lance cannot build
  (ceph/ceph#71935)
- cmake: make SIMD_COMPILE_FLAGS a list (ceph/ceph#72657)
- cmake/boost: do not pass context-impl to the headers step
  (ceph/ceph#71249)
- rpm: let ceph-mgr-cephadm require routes (ceph/ceph#73051)
- test/mds: widen result waits in ReleaseAwait (ceph/ceph#70463)
- qa/lsan.supp: match OpenSSL error state on ERR_set_mark
  (ceph/ceph#71460)

Signed-off-by: Sun Yuechi <[email protected]>
misaka00251 pushed a commit to openRuyi-Project/openRuyi that referenced this pull request Oct 28, 2026
The new snapshot brings in these fixes:
- osd/PeeringState: fix the divergence check against olog.head
  (ceph/ceph#70149)
- osd: assert OI_ATTR is present in rollback_setattrs (ceph/ceph#70965)
- osdc: fix ReplicaSplitOp chunk distribution, reassembly and
  small multi-op reads (ceph/ceph#70207)
- erasure-code/isa: default the technique when the profile has none
  (ceph/ceph#72215)
- mount.ceph: report kernels without aes256k key support
  (ceph/ceph#72159)
- rgw/es: require both major and minor in the ES version
  (ceph/ceph#70007)
- build: turn WITH_RADOSGW_LANCEDB off where lance cannot build
  (ceph/ceph#71935)
- cmake: make SIMD_COMPILE_FLAGS a list (ceph/ceph#72657)
- cmake/boost: do not pass context-impl to the headers step
  (ceph/ceph#71249)
- rpm: let ceph-mgr-cephadm require routes (ceph/ceph#73051)
- test/mds: widen result waits in ReleaseAwait (ceph/ceph#70463)
- qa/lsan.supp: match OpenSSL error state on ERR_set_mark
  (ceph/ceph#71460)

Signed-off-by: Sun Yuechi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants