Skip to content

crimson/osd/recovery_backend: scan_for_backfill to use obc_manager#61536

Merged
Matan-B merged 7 commits intoceph:mainfrom
Matan-B:wip-matanb-backfill-scan
Mar 12, 2025
Merged

crimson/osd/recovery_backend: scan_for_backfill to use obc_manager#61536
Matan-B merged 7 commits intoceph:mainfrom
Matan-B:wip-matanb-backfill-scan

Conversation

@Matan-B
Copy link
Contributor

@Matan-B Matan-B commented Jan 27, 2025

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
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows
  • jenkins test rook e2e

@Matan-B
Copy link
Contributor Author

Matan-B commented Jan 27, 2025

This is an alternative (draft) solution to: #60989. @xxhdx1985126, let me know what you think. Thanks!

co_await interruptor::parallel_for_each(objects, [this, version_map]
(const hobject_t& object) -> interruptible_future<> {
crimson::osd::ObjectContextRef obc;
if (pg.is_primary()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure this is relevant to us. In classic, we have this check to not use object_contexts on non primaries. Nevertheless, we would still fallback to "loading" this object.

Copy link
Member

Choose a reason for hiding this comment

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

it looks like a memory-saving measure to me, still relevant here - replicas don't usually cache object contexts, so we're bypassing the obc cache on them.

In classic at least, the primary normally processes reads and the obc-loading part of a write, and the secondaries just get the resulting transaction and log to apply, so the replicas don't waste cache on an obc they won't use. Is crimson structured the same way?

Copy link
Contributor Author

@Matan-B Matan-B Feb 6, 2025

Choose a reason for hiding this comment

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

replicas don't usually cache object contexts, so we're bypassing the obc cache on them.

That seems to be the original intent of this if-case, thank you for looking into this.
While the logic remains true for Crimson, the issue here is that using the cache directly (without the obc manager) would expose this obc in undefined state - e.g not loaded yet.

I think that we should still omit this bit in Crimson and prevent replicas from caching obcs from within the obc_loader. This will allow us to eventually prevent direct cache usage (one user left after this PR) and we could prevent the redundant caching later on.
What do you think?

Copy link
Contributor Author

@Matan-B Matan-B Feb 6, 2025

Choose a reason for hiding this comment

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

btw, won't secondaries obc caching benefit to replicated reads cases?

Copy link
Member

Choose a reason for hiding this comment

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

That sounds like a good approach, better to encapsulate the loading logic as you suggest. Localized reads (reading from secondary) could potentially benefit from the cache, but this is not the common case, and I'd guess this code in classic predated localized reads.

I'm not sure it affects performance much, but it's possible the obc cache should not be used by backfill/scrub at all, since they aren't indicative of future use of those objects by clients.

@github-actions
Copy link

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

@Matan-B Matan-B force-pushed the wip-matanb-backfill-scan branch from b439f48 to daed82e Compare February 2, 2025 13:28
@Matan-B Matan-B force-pushed the wip-matanb-backfill-scan branch from daed82e to dd2c209 Compare February 2, 2025 13:44
@Matan-B Matan-B marked this pull request as ready for review February 2, 2025 14:26
@Matan-B Matan-B requested a review from a team as a code owner February 2, 2025 14:26
@github-actions github-actions bot added the tests label Feb 2, 2025
@Matan-B Matan-B requested a review from athanatos February 2, 2025 15:10
@xxhdx1985126
Copy link
Contributor

This is an alternative (draft) solution to: #60989. @xxhdx1985126, let me know what you think. Thanks!

LGTM!

@github-actions
Copy link

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

@Matan-B
Copy link
Contributor Author

Matan-B commented Feb 24, 2025

@Matan-B Matan-B force-pushed the wip-matanb-backfill-scan branch from 02c071a to b658375 Compare February 25, 2025 10:57
@Matan-B Matan-B force-pushed the wip-matanb-backfill-scan branch 2 times, most recently from fb73c02 to 0cc8214 Compare March 5, 2025 07:18
Matan-B added 7 commits March 10, 2025 12:48
Signed-off-by: Matan Breizman <mbreizma@redhat.com>
let obc_loader get the relevant obc and avoid duplicating the
loading logic.

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

Signed-off-by: Matan Breizman <mbreizma@redhat.com>
Already checked in handle_recovery_op.

Signed-off-by: Matan Breizman <mbreizma@redhat.com>
Signed-off-by: Matan Breizman <mbreizma@redhat.com>
Signed-off-by: Matan Breizman <mbreizma@redhat.com>
We could also use here seastar::coroutine::parallel_for_each. However,
an `interruptible` overload must be used. Instead, use the coroutine
which wrapper is simpler this time.

```
kernel callstack:
    #0 0x56f6e7a in seastar::lw_shared_ptr<std::map<hobject_t, eversion_t, std::less<hobject_t>, std::allocator<std::pair<hobject_t const, eversion_t> > > >::operator->() const /home/matan/ceph/src/seastar/include/seastar/core/shared_ptr.hh:347
    #1 0x56f6e7a in operator() /home/matan/ceph/src/crimson/osd/recovery_backend.cc:245
    #2 0x5286c62 in std::__n4861::coroutine_handle<crimson::internal::promise_base<crimson::interruptible::interruptor<crimson::osd::IOInterruptCondition>, void, void> >::resume() const /opt/rh/gcc-toolset-13/root/usr/include/c++/13/coroutine:24

SUMMARY: AddressSanitizer: stack-use-after-return /home/matan/ceph/src/seastar/include/seastar/core/shared_ptr.hh:347 in seastar::lw_shared_ptr<std::map<hobject_t, eversion_t, std::less<hobject_t>, std::allocator<std::pair<hobject_t const, eversion_t> >

```

Signed-off-by: Matan Breizman <mbreizma@redhat.com>
@Matan-B Matan-B moved this from In Progress to Needs QA in Crimson Mar 10, 2025
@Matan-B Matan-B force-pushed the wip-matanb-backfill-scan branch from 0cc8214 to 6dfc166 Compare March 10, 2025 13:01
@Matan-B Matan-B requested a review from cyx1231st March 10, 2025 13:36
@Matan-B
Copy link
Contributor Author

Matan-B commented Mar 10, 2025

@cyx1231st
Copy link
Member

Not sure about the details in backfill-recovery, I don't see any issues, LGTM!

@Matan-B
Copy link
Contributor Author

Matan-B commented Mar 11, 2025

@Matan-B
Copy link
Contributor Author

Matan-B commented Mar 12, 2025

@Matan-B Matan-B merged commit 2bb6ae3 into ceph:main Mar 12, 2025
11 checks passed
@Matan-B Matan-B moved this from Needs QA to Merged in Crimson Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Merged (Pre Tentacle Freeze)

Development

Successfully merging this pull request may close these issues.

5 participants