crimson/osd/recovery_backend: scan_for_backfill to use obc_manager#61536
crimson/osd/recovery_backend: scan_for_backfill to use obc_manager#61536
Conversation
|
This is an alternative (draft) solution to: #60989. @xxhdx1985126, let me know what you think. Thanks! |
src/crimson/osd/recovery_backend.cc
Outdated
| co_await interruptor::parallel_for_each(objects, [this, version_map] | ||
| (const hobject_t& object) -> interruptible_future<> { | ||
| crimson::osd::ObjectContextRef obc; | ||
| if (pg.is_primary()) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
btw, won't secondaries obc caching benefit to replicated reads cases?
There was a problem hiding this comment.
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.
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
b439f48 to
daed82e
Compare
daed82e to
dd2c209
Compare
LGTM! |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
b8fba29 to
02c071a
Compare
02c071a to
b658375
Compare
fb73c02 to
0cc8214
Compare
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>
See: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rcoro-reference-parameters Signed-off-by: Matan Breizman <mbreizma@redhat.com>
0cc8214 to
6dfc166
Compare
|
Not sure about the details in backfill-recovery, I don't see any issues, LGTM! |
move scan_for_backfill to coroutine
let obc_loader get the relevant obc and avoid duplicating the loading logic.
Fixes: https://tracker.ceph.com/issues/69154
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
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windowsjenkins test rook e2e