Skip to content

EC Direct Reads - #66459

Merged
JonBailey1993 merged 24 commits into
ceph:mainfrom
aainscow:ec_direct_reads_pr2
Jun 3, 2026
Merged

JonBailey1993 merged 24 commits into
ceph:mainfrom
aainscow:ec_direct_reads_pr2

Conversation

@aainscow

@aainscow aainscow commented Dec 1, 2025 •

Copy link
Copy Markdown
Contributor

This is the final PR (other than bug fixes). The main features:

  1. A new test harness
  2. Some extensions to io_sequence to test direct reads.
  3. Support for plugins where shard != raw_shard (LRC)
  4. Split-write detection and recovery.
  5. New stats
  6. Pretty much a complete re-write of SplitOp.cc

Fixes: https://tracker.ceph.com/issues/74061

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

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)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@github-actions

github-actions Bot commented Dec 2, 2025

Copy link
Copy Markdown

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

@aainscow
aainscow force-pushed the ec_direct_reads_pr2 branch 2 times, most recently from 2c28618 to 52bc883 Compare December 2, 2025 15:04
@@ -1393,6 +1393,8 @@ inline namespace v14_2_0 {
int application_metadata_list(const std::string& app_name,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

NOTE: This is from a different PR.

@github-actions

github-actions Bot commented Feb 4, 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

@github-actions

github-actions Bot commented Apr 5, 2026

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

aainscow and others added 17 commits May 28, 2026 15:15
SplitOps will add support to split replica reads. This allows the user to
specify the threshold at which they are split.

The default is currently set at 256k.  This is set at a point where we have
confidence that split ops will never reduce performance.

Development may choose to reduce this default based on performance measurements.

Signed-off-by: Alex Ainscow <[email protected]>
Signed-off-by: Callum James <[email protected]>
Signed-off-by: Jon Bailey <[email protected]>
This statistic counts the number of OPs which have been submitted using the
split op mechanism.  It allows a user to check how useful this is and
performance/development to check that this mechanism is being used in
any given application.

Signed-off-by: Alex Ainscow <[email protected]>
…tOp decision point.

The locking situation in Objecter is complex. When ops are completed whether with success or otherwise, some locks are held. For split ops, this is particularly complex, since multiple sessions are involved in the completion.

To avoid all these deadlock issues, splitOps choose to schedule a completion task using asio::post, which can then take the appropriate locks before completing the IO, without risk of deadlock.

Usage of this will be added in a refactor of SplitOps.

In addition, previously split ops was being calculated immediately as soon as the op was submitted.  Here we move the submit down to below the throttling and timeout code.  This way we throttle/timeout the original op.

Handling the timeout (op_cancel) will be handled in a later commit.

As part of this commit we also introduce a SplitOp session. This allows us to keep track of the parent ops while the child ops have been submitted and redrive the correct op(s) when necessary.

Signed-off-by: Alex Ainscow <[email protected]>
Signed-off-by: Jon Bailey <[email protected]>
This was one big monolithic function which handled the entire reply message.

SplitOps needs to re-use parts of this function. The previous split ops
commit dealt with one split, but this adds another.

Also rename the functions to have a better name.

Signed-off-by: Alex Ainscow <[email protected]>
SplitOp calculates the target and set the necessary target OSD itself. This
means that calc_target is not required again on first submit of the sub
read ops.

Signed-off-by: Alex Ainscow <[email protected]>
When an op that has been split is canceled or timed out, all the
sub ops need to be canceled.

This commit adds a mechanism to map the original op to the sub reads.

Signed-off-by: Alex Ainscow <[email protected]>
There are large number of changes in this commit which were found through
development and testing of split ops.

I have split out all the objecter updates carefully, but since the split op
code is not currently used in production, I have not documented every change
and made significant refactors/rearrangements.

Signed-off-by: Alex Ainscow <[email protected]>
Added optional "-b"/"balanced" flag to the end of read/read2/read3 operations in interactive mode, to make them balanced reads.
Balanced read percentage is not used in interactive mode.

Add command line argument to specify percentage of read ops that should use the balanced reads flag. Default is 100%.

Signed-off-by: Matty Williams <[email protected]>
Signed-off-by: Alex Ainscow <[email protected]>
Signed-off-by: Jon Bailey <[email protected]>
Fixed a bug where reference_sub_read was set to -1 when non-read operations
were processed before read operations, causing crashes when accessing
sub_reads[reference_sub_read].

Changes:
1. Added init_reference_sub_read() virtual method to initialize reference_sub_read
   early, after _calc_target() populates the acting set but before processing
   any operations.

2. ECSplitOp::init_reference_sub_read(): Sets reference_sub_read to the acting
   index of the primary shard by performing a reverse lookup.

3. ReplicaSplitOp::init_reference_sub_read(): Counts valid OSDs and picks a
   random acting index for load balancing.

4. Simplified init_read() in both classes by removing duplicate logic that
   previously set reference_sub_read during read processing.

5. Added safety check in SplitOp::init() to ensure the reference_sub_read
   entry exists in sub_reads before accessing it for non-read operations.

The fix ensures reference_sub_read is always set before any operations are
processed, preventing the crash that occurred when STAT, GETXATTR, or other
non-read operations appeared before READ operations in the operation list.

Tested with split_op_cxx.cc test suite: 33/35 tests pass (2 test expectation
issues unrelated to the core bug fix).

Signed-off-by: Alex Ainscow <[email protected]>
Previously the librados tests were each restricted to a particular
configuration. Here we parameterize to execute against multiple
configurations of pool and fix the necessary create/clean up work.

Signed-off-by: Alex Ainscow <[email protected]>
Signed-off-by: Jon Bailey <[email protected]>
…_command

The do_mon_command() method was calling the mocked mon_command() which
has a default action that calls do_mon_command(), creating an infinite
recursion that caused a segmentation fault due to stack overflow.

Fixed by calling TestRadosClient::mon_command() (the base class
implementation) instead of the mocked version.

This resolves the segfault in unittest_librbd when running the
run-rbd-unit-tests.sh script.

Signed-off-by: Alex Ainscow <[email protected]>
Signed-off-by: Alex Ainscow <[email protected]>
Signed-off-by: Callum James <[email protected]>
Signed-off-by: Alex Ainscow <[email protected]>
Signed-off-by: Callum James <[email protected]>
Previously the test_rados_tool.sh test was dependant on flag ordering. This mean if you added a new flag after full_quota (such as split_reads or ec_optimizations), this could break the teuthology test if we try to test with these flags on. We prevent this by changing this condition to use json to ensure we are no longer depend on the order of the flags which the default command line output gives.

This also adds a check to ensure the pool name matches what we are working on, to ensure we don't get false-positives if we happened to have other pools.

Signed-off-by: Jon Bailey <[email protected]>
@JonBailey1993

Copy link
Copy Markdown
Contributor

@JonBailey1993

Copy link
Copy Markdown
Contributor

jenkins test dashboard cephadm

@batrick batrick left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I saw this was approved through QA. I am adding an empty request changes review so I can check it before merge.

@batrick batrick left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm fine with this from a Umbrella release perspective. I've not analyzed any of the technical details in depth.

However, I do want to comment that the lack of dev docs makes me ☹️ (@MattyWilliams22 raised the bar!)

Comment thread src/mon/MonCommands.h
@@ -1171,7 +1171,7 @@ COMMAND("osd pool rename "
"rename <srcpool> to <destpool>", "osd", "rw")
COMMAND("osd pool get "
"name=pool,type=CephPoolname "
"name=var,type=CephChoices,strings=size|min_size|pg_num|pgp_num|crush_rule|hashpspool|nodelete|nopgchange|nosizechange|write_fadvise_dontneed|noscrub|nodeep-scrub|hit_set_type|hit_set_period|hit_set_count|hit_set_fpp|use_gmt_hitset|target_max_objects|target_max_bytes|cache_target_dirty_ratio|cache_target_dirty_high_ratio|cache_target_full_ratio|cache_min_flush_age|cache_min_evict_age|erasure_code_profile|min_read_recency_for_promote|all|min_write_recency_for_promote|fast_read|hit_set_grade_decay_rate|hit_set_search_last_n|scrub_min_interval|scrub_max_interval|deep_scrub_interval|recovery_priority|recovery_op_priority|scrub_priority|compression_mode|compression_algorithm|compression_required_ratio|compression_max_blob_size|compression_min_blob_size|csum_type|csum_min_block|csum_max_block|allow_ec_overwrites|fingerprint_algorithm|pg_autoscale_mode|pg_autoscale_bias|pg_num_min|pg_num_max|target_size_bytes|target_size_ratio|dedup_tier|dedup_chunk_algorithm|dedup_cdc_chunk_size|eio|bulk|read_ratio|pct_update_delay|allow_ec_optimizations",
"name=var,type=CephChoices,strings=size|min_size|pg_num|pgp_num|crush_rule|hashpspool|nodelete|nopgchange|nosizechange|write_fadvise_dontneed|noscrub|nodeep-scrub|hit_set_type|hit_set_period|hit_set_count|hit_set_fpp|use_gmt_hitset|target_max_objects|target_max_bytes|cache_target_dirty_ratio|cache_target_dirty_high_ratio|cache_target_full_ratio|cache_min_flush_age|cache_min_evict_age|erasure_code_profile|min_read_recency_for_promote|all|min_write_recency_for_promote|fast_read|hit_set_grade_decay_rate|hit_set_search_last_n|scrub_min_interval|scrub_max_interval|deep_scrub_interval|recovery_priority|recovery_op_priority|scrub_priority|compression_mode|compression_algorithm|compression_required_ratio|compression_max_blob_size|compression_min_blob_size|csum_type|csum_min_block|csum_max_block|allow_ec_overwrites|fingerprint_algorithm|pg_autoscale_mode|pg_autoscale_bias|pg_num_min|pg_num_max|target_size_bytes|target_size_ratio|dedup_tier|dedup_chunk_algorithm|dedup_cdc_chunk_size|eio|bulk|read_ratio|pct_update_delay|allow_ec_optimizations|ec_data_shard_count|ec_coding_shard_count",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This will conflict as soon as #66726 is merged.

I suggest that we end future instance of that by breaking each setting into a separate line. It's a recipe for regressions if someone accidentally removes a new setting during conflict resolution.

Comment thread src/mon/OSDMonitor.cc

if (osdmap.require_osd_release < ceph_release_t::umbrella &&
tmp.require_osd_release >= ceph_release_t::umbrella) {
dout(10) << __func__ << " first umbrella+ epoch" << dendl;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

#66726 (comment)

I think whichever is chosen, we should do these implicit OSDMap upgrades in the same location. Otherwise it's prone to mistakes/confusion.

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.

Agree will fix 66726 to follow convention

Comment thread src/mon/OSDMonitor.cc
bool force;
cmd_getval(cmdmap, "yes_i_really_mean_it", force);
if (!force) {
ss << "This is a development tool and should not be used in production.";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Have you not seen the tee-shirts people wear at Cephalocon?

@aainscow

aainscow commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

However, I do want to comment that the lack of dev docs makes me ☹️ (@MattyWilliams22 raised the bar!)

https://docs.ceph.com/en/latest/dev/osd_internals/erasure_coding/direct_reads/

This was added in an earlier PR.

@bill-scales

Copy link
Copy Markdown
Contributor

I'm fine with this from a Umbrella release perspective. I've not analyzed any of the technical details in depth.

However, I do want to comment that the lack of dev docs makes me ☹️ (@MattyWilliams22 raised the bar!)

Design documentation was in a previous PR - see https://docs.ceph.com/en/latest/dev/osd_internals/erasure_coding/direct_reads/ for all the design documentation for this feature.

However I agree that we could improve the user documentation in a few areas:

https://docs.ceph.com/en/latest/man/8/rbd/ - see read_from_replica
https://docs.ceph.com/en/latest/rbd/rbd-config-ref/#confval-rbd_read_from_replica_policy -rbd_read_from_replica_policy
https://docs.ceph.com/en/latest/man/8/mount.ceph/ - see read_from_replica

@JonBailey1993 can you raise another PR to address doc updates on these pages to explain that this setting now applies to EC pools as well and that it can significantly improve performance

There sadly isn't any user documentation for the conf settings rados_replica_read_policy / rados_replica_read_policy_on_objclass (beyond the .conf file) although they are advanced config options and our teuthology test results suggest there are still some base code issues to fix before we start suggesting users turn this on. When these issues are fixed perhaps we should add a new section to the docs - perhaps a "direct, balanced and localized reads" section as a sub topic under https://docs.ceph.com/en/latest/rados/configuration/ , it would also make sense to reference this section from https://docs.ceph.com/en/latest/rados/operations/stretch-mode/ as the main use case for localized reads is when using a stretch cluster.

Longer term I'd like to get to a point where balanced reads can be turned on by default for all protocols, as far as performance is concerned we are in a position where balanced reads will always result in the same or much better performance, stability wise I think that there are still corner case bugs when using rados_replica_read_policy (but not when using the more selective rbd or cephfs options) that mean we aren't ready to make this change yet.

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

This is an automated message by src/script/redmine-upkeep.py.

I have resolved the following tracker ticket due to the merge of this PR:

No backports are pending for the ticket. If this is incorrect, please update the tracker
ticket and reset to Pending Backport state.

Update Log: https://github.com/ceph/ceph/actions/runs/26875249660

@MaxKellermann MaxKellermann mentioned this pull request Jun 3, 2026
4 of 14 tasks
Comment thread src/osd/osd_types.h
}

void set_shard_mapping(std::vector<shard_id_t> && mapping) {
shard_mapping = mapping;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What's the point of passing a rvalue reference to this method, when the method body allocates a new copy of the std::vector? Did you forget std::move() here?

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.