Skip to content

OSD: EC recovery zero detect - #63408

Merged
aainscow merged 3 commits into
ceph:mainfrom
aainscow:ec_recovery_zero_detect
Jul 25, 2025
Merged

aainscow merged 3 commits into
ceph:mainfrom
aainscow:ec_recovery_zero_detect

Conversation

@aainscow

@aainscow aainscow commented May 21, 2025 •

Copy link
Copy Markdown
Contributor

Optimised EC already performs "sparse writes":

  • Writes are padded out to 4k with zeros if required.
  • Where encoding is required, unmapped is interpreted as zeros.
  • Optimised EC does not yet support or use sparse reads.

The problem is that when recovering a missing shard from coding, we cannot tell the difference between a 4k extent containing zeros to an unmapped 4k region. This is a major issue because the size of the data on the OSDs will increase significantly when being recovered.

To solve the space issue, this PR plans to convert any recovered 4k buffer to be "unmapped" at the backend.

There are two techniques that could be employed here:

  • Scan for aligned 4k buffers that are zeros
  • Perform a sparse read during recovery and skip decode where all shards are unmapped.

This PR implements the FIRST of these as it entirely solves the space issue and we will leave the second as a backfill performance enhancement for the future.

I want to put this in after fixing a number of EC bugs, so as it is easier to test, however, it has caused some concern, specifically in conjunction with @rzarzynski 's zero buffer PR.

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

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

Comment thread src/osd/ECUtil.cc Resolved
@aainscow
aainscow requested review from aclamk and rzarzynski May 21, 2025 16:29
@aainscow
aainscow force-pushed the ec_recovery_zero_detect branch from 2209980 to 2098098 Compare May 22, 2025 13:19
Comment thread src/osd/ECUtil.cc Resolved
Comment thread src/osd/ECUtil.cc Resolved
@markhpc markhpc changed the title Ec recovery zero detect OSD: EC recovery zero detect May 29, 2025
@aainscow
aainscow force-pushed the ec_recovery_zero_detect branch from 2098098 to 0d44f33 Compare June 24, 2025 16:42
@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

@aainscow

Copy link
Copy Markdown
Contributor Author

We have reached agreement about how to implement this. I will update the design once I have a tested commit ready.

@aainscow
aainscow force-pushed the ec_recovery_zero_detect branch from 0d44f33 to c07486a Compare July 11, 2025 10:24
@aainscow
aainscow force-pushed the ec_recovery_zero_detect branch from c07486a to 10664a4 Compare July 11, 2025 10:27
@aainscow
aainscow requested a review from rzarzynski July 11, 2025 10:28
@aainscow

Copy link
Copy Markdown
Contributor Author

@rzarzynski I have refactored this completely:

  1. dedup occurs as close to decode/encode as possible.
  2. zero buffers are now late-initialised.
  3. I have squashed some of your commits, so they are easier to review

@rzarzynski rzarzynski 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.

Basically LGTM-with-some-questions.

For this will need upgrade testing.

Comment thread src/common/buffer.cc Resolved
Comment thread src/common/buffer.cc Resolved
Comment thread src/common/buffer.cc Outdated

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.

ditto.

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.

Fixed

Comment thread src/osd/ECBackend.cc Outdated

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.

nit: the space before auto.

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.

Fixed

Comment thread src/osd/ECBackend.cc Outdated

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.

I think it's unnecessary. The zero deduplication switched out from operating at the abstract Message in favor of concrete messages (like MOSDOp) to leverage versioning already available there. data_included seems even better as it can be backward compatible universally, regardless of versioning.

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.

I have removed the comment.

Comment thread src/osd/ECUtil.h Outdated

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.

nit: putting some spaces within the ternary operator would help humans.

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.

Fixed

Comment thread src/osd/ECUtil.h Outdated

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.

Hmm, ISET suggest a constant, not a template parameter. How about IntervalSetT?

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.

Changed

Comment thread src/osd/ECUtil.h Outdated

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.

No need to use this rather costly call; bufferlist can be iterated by buffer pointers it stores:

for (const auto& bp : bl.buffers()) {
  // ...
}

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.

Ah... I have been looking for an interface that does this. Obvious now you point it out.

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.

Fixed

Comment thread src/test/osd/TestECBackend.cc Outdated

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.

Yeah, zero-bptr is not writeable. The bl 0dedup PR brings ptr_ro type to express that through the type system. Hopefully we'll be able to delegate this check to... compilers.

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.

I think we might actually want to make use of the the zero-buffer in some plugins. For now, its certainly true that if we pass a zero buffer to a plugin, it will panic due to the mprotect.

Comment thread src/test/osd/TestECBackend.cc Outdated

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.

Is the entire change in minimum_to_decode() nothing more than a refactoring?

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.

I can't remember why it was needed, but this is about making the test harness implementation closer to common plugins like ISA-L

@aainscow
aainscow force-pushed the ec_recovery_zero_detect branch from 10664a4 to 79d0203 Compare July 15, 2025 13:05
@aainscow
aainscow requested a review from rzarzynski July 15, 2025 13:14
@aainscow
aainscow marked this pull request as ready for review July 15, 2025 13:15
@aainscow
aainscow requested a review from a team as a code owner July 15, 2025 13:15
rzarzynski and others added 3 commits July 16, 2025 17:07
…is_zero_fast()

Signed-off-by: Radoslaw Zarzynski <[email protected]>
Signed-off-by: Alex Ainscow <[email protected]>
@aainscow

Copy link
Copy Markdown
Contributor Author

jenkins test make check

2 similar comments
@aainscow

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@aainscow

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@connorfawcett

Copy link
Copy Markdown
Contributor

@aainscow
aainscow merged commit 9f944d3 into ceph:main Jul 25, 2025
@rzarzynski

Copy link
Copy Markdown
Contributor

@aainscow: it's merged! If it's intended for T, we need a backport.

@aainscow aainscow added the backport-complete A backport was necessary, but all work has been completed. label Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-complete A backport was necessary, but all work has been completed. common core needs-qa performance tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants